Closed technocidal closed 5 years ago
Hi Johannes,
Thanks a lot for reporting this, looks like we forgot to convert the underlying NSError
to PromiseError.timedOut
case for the timeout
operator in Swift.
If you like, feel free to submit a PR with the fix, or use the following workaround to catch .timedOut
properly:
switch PromiseError(error) ?? error {
case is PromiseError:
break
default:
break
}
Thanks!
Hi Anthony,
thank you for your response. I will submit a PR.
Thank you for your support
Suppose one has a scenario where a promise/chain of promises can be potentially rejected with several different error types.
When switching over the error
or casting directly
will never succeed.
This makes it really hard to test for
PromiseError.timedOut
, when other errors need to be handled as well.The work around is quite unintuitive as one first needs to cast the error to
NSError
and then check the error domain.If one wants to specifically target the
PromiseError.timedOut
one would need to check for thePromiseError.timedOut.errorCode
as well.Am I doing something wrong or is there a specific reason for this?