Closed godhedin closed 4 years ago
Having the default rejection handler is necessary even if you specify a custom rejection handler to handle the case where your custom rejection handler threw an exception itself. In the code you mention, if your custom rejection handler handled the exception then the default handler should not be called
Then(onResolved, onRejected) // onRejected handles rejection
.Catch(ex => // <- this callback should never be executed if the rejection was already handled.
Promise.PropagateUnhandledException(this, ex)
);
If that's not happening and Promise.PropagateUnhandeldException
is still being called in addition to or instead of your custom onRejected
callback, then that is a bug.
Your have a good feature default catcher If developer had mistake and not realized catcher all exception process in default catcher
but in this way you can't write custom catch callback in done
default handler will be processed anyway
I think that the behavior should be like this: if there are custom callback handlers then process there and if not, then process in default catcher
and