-
-
Notifications
You must be signed in to change notification settings - Fork 652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-throwing error in transaction catch block will propagate transaction error again #1684
Comments
I copied and pasted your repro into a jsfiddle but I get what was expected, the "throw again" error. |
@dfahlander Well, the |
I see. The code behaves as expected in terms of what code paths are visited but the problematic thing is that unhandledrejection gets fired even though you are catching the error. The problem origins from the custom propagation to unhandledrejection that we do for legacy reasons (such as supporting Internet Explorer). I'll see what we can do fix it and whether it would be ok now in Dexie 4.0 to remove that custom propagation of unhandledrejection as it can generate undesired and inaccurate noise in the debugging experience. Not to self: Check if we can remove our custom unhandledrejection propagation in the promise module and rely on the native unhandledrejection to do its job. |
The custom unhandledrejection event propagation is not reliable when native async function throw errors. The event is fired before we have a chance to detect that the error was indeed handled in a later tick. User code should not rely on unhandledrejection anyway but have it as a debugging tool rather - to detect errors in the code where promises aren't caught properly. Users that use async functions will get the native unhandledrejection functionality anyway, but those who still use promise-based .then()/ .catch() might not get this warning anymore after this commit. However, I believe it's better to not warn when the warning is not correct anyway. Related issues: * #1706 * #1689 * #934 Resolves #1684
Repro
It's weird that
throw again
error was caught butinner error
was exposed unexpectedly.Dexie Version
3.2.1
The text was updated successfully, but these errors were encountered: