You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(It's not strictly a bug, more of an API issue :-) )
Let's take the example code from the homepage and modify it slightly to get a 404 response from housetop.info.
importdispatch._, Defaults._valsvc= url("http://api.hostip.info/country.php-NOT-FOUND")
valcountry=Http(svc OK as.String)
country.recover { case e => println(e.getClass.getCanonicalName) }
The last line will eventually print java.util.concurrent.ExecutionException. To get to the actual error (StatusCode) I first need to unwrap it.
It would seem intuitive that for a common use case like a non-OK status code returned from the HTTP server the future would fail with StatusCode straight away, which is not the case.
I'm using dispatch 0.11.2.
The text was updated successfully, but these errors were encountered:
This seems like a reasonable ask. Given that Dispatch 0.12 and 0.13 have already frozen their APIs, I think the earliest we'd be able to address this is Dispatch 0.14. Before I commit to it though, I want the Development of AHC 2.1 to settle down, since I'm also angling to get that into Dispatch 0.14.
The execution exception itself isn't a terribly useful measure of what actually happened under the
hood. As a result, #111 proposed unwrapping them before finishing the future. I'm still not sure
what I think of this idea, but it was straightforward enough to implement and we have some time
before 0.14.x is declared final.
(It's not strictly a bug, more of an API issue :-) )
Let's take the example code from the homepage and modify it slightly to get a 404 response from housetop.info.
The last line will eventually print
java.util.concurrent.ExecutionException
. To get to the actual error (StatusCode
) I first need to unwrap it.It would seem intuitive that for a common use case like a non-OK status code returned from the HTTP server the future would fail with
StatusCode
straight away, which is not the case.I'm using dispatch 0.11.2.
The text was updated successfully, but these errors were encountered: