Open dionjwa opened 6 years ago
Basically, I want a conditional catch/errorPipe: when I examine the error, I may want to rethrow, or convert to a non-error.
This sounds reasonable. I could provide some kind of errorMap() function that just lets you map the error type and automatically rethrow. Another alternative is just to do a try/catch around the error handler methods as well, and let you manually rethrow within those.
That would be great. errorMap
sounds clear, but it's not clear what the second approach would look like.
Yeah, the second approach wouldn't work. The catchError function isn't designed to propagate errors, only handle them. I'll look into errorMap.
I'm trying to catch a raw error, and convert it to a more useful error. Something like:
The examples that do something similar involve catching the error, using haxe's nice
catch
type checking, and rethrowing. But that cannot work here because the return type ofPromise.catchError()
is anAsyncBase
, and errorPipe doesn't handle errors throw in it, or from promises it returns.So I'm confused if this is possible. It seems like a reasonable use case, but I'm a bit stumped.