Reputation: 1154
I currently try to call a bunch of webservices in parallel. In the end I want to evaluate all the responses. Therefore I use Promise.sequence
. Unfortunately the whole method fails if one of the web calls failed. I would be satisfied if I just get the response of the succeeded calls.
Is there some way to perform the Promise.sequence
and just retrieve the succeeded calls? After that it would be nice to handle the failed calls in any separate way.
Upvotes: 0
Views: 184
Reputation: 1154
I found a solution for now. For each Promise
i create via ws.url("http://...").get()
i define a recover
method, e.g.
ws.url(theUrl).get().recover((t) -> null)
So when these Promises are processed via Promise.sequence
no error is thrown (because it was already catched by the recover of the particular WS call promise).
Later on I just have to check if a result is null and then drop it from further processing.
Upvotes: 1