carson-katri / swift-request

Declarative HTTP networking, designed for SwiftUI
MIT License
730 stars 41 forks source link

RequestError not passed back to .onError handler? #17

Closed andrew-shoonya closed 4 years ago

andrew-shoonya commented 4 years ago

First: love the library. I learned a lot about Combine just browsing.

In my first test project, correct usage just works. (!) When I introduce a deliberate error in the URL, I don't get a call to the .onError handler. Instead, the system logs a lot of stuff. (Below.) What can I do to ensure that my app can handle such errors?

Connection 1: received failure notification
Connection 1: failed to connect 12:8, reason -1
Connection 1: encountered error(12:8)
Task <D69B0AC6-...>.<1> HTTP load failed, 0/0 bytes (error code: -1003 [12:8])
Task <D69B0AC6-...>.<1> finished with error [-1003] 
Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." 
UserInfo={... useful stuff in here but it's not getting to my handler ... }
carson-katri commented 4 years ago

I've fixed it for 1.2.2. Hope that works for you!

andrew-shoonya commented 4 years ago

Thank you! This is also the first time I've used SPM (in Xcode) and it is also working right the first time. A real pleasure.