-
Notifications
You must be signed in to change notification settings - Fork 368
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
Update DB error handling to reject with Error objects #333
base: main
Are you sure you want to change the base?
Conversation
Promise rejections generate PromiseRejectionEvents (PREs). PREs allow specifying a reason. Rejecting with an Error object improves debugging because the Error will contain an Error message and stack trace. DOMExceptions and DOMErrors do not extend Error but can be passed as the underlying cause in the Error as well.
If the fix only 'rewrote' |
TY Jake, totally agree that all browsers return true when comparing DOMExceptions with Error. I use the closure compiler and I can't convinced it the above is true: I have a conformance check run by the compiler that asserts that I think this is b/c idl does lists wdyt of:
This should effectively be a no-op (except for
This should only happen on very old browsers--there's no constructor for |
But I'm less interested in a test that fakes this, and more interested in the real world case where this has been an issue. I'm assuming that you've hit a case where this library has rejected a promise with a |
Or, is this not actually a runtime issue, and just an issue with closure compiler's type system? If that's the case, I'd rather find a way that doesn't increase the size of this library, and doesn't change types of errors folks might be expecting. I'm not that familiar with closure compiler these days. What's making it think that |
Would |
I tested this and it solves one of my issues (
I strongly suspect this is the case. The DOMError piece should only occur on very old browsers that see minimal adoption at this point. Specifically the versions between the
That's very understandable! Some options, lmkwyt:
|
Hey Jake, not trying to rush you, just a quick update that this may actually help diagnose runtime issues. One of the developers I work with suspects we may not be getting useful stack traces in some IDB-related cases. Their report on a PR on their own repo:
|
Promise rejections generate PromiseRejectionEvents (PREs). PREs allow specifying a
reason
.Rejecting with an Error object improves debugging because the Error will contain an Error message and stack trace. DOMExceptions and DOMErrors do not extend Error but can be passed as the underlying cause in the Error to retain the original IDB request or transaction error details.