-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat: support native Error causes #141
Conversation
65d0f41
to
4a34b24
Compare
functions: 94.44, | ||
lines: 92.85, | ||
statements: 92.85, | ||
branches: 91.89, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reductions here arise from the fallback never triggering since native causes are not used in all tested environments.
Adding test-coverage for the fallback would involve some wider changes to the test suite, I believe.
7daf2d3
to
a44c9ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense. When serialised, the cause is still serialised as data.cause
, right?
That's the idea, yes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@@ -3,7 +3,7 @@ | |||
"esModuleInterop": true, | |||
"exactOptionalPropertyTypes": true, | |||
"forceConsistentCasingInFileNames": true, | |||
"lib": ["ES2020"], | |||
"lib": ["ES2022"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'm not sure we can do this yet due to React Native not supporting ES2020+. There is a thread in chat about this. Search for "ES2020"; it should be the third message down. (I'll DM it to you.)
These changes look good to me otherwise, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcmire Since es2022
is not an option, which of the following is preferred?
- Adding
dom
instead - Defining/shadowing the
cause
property explicitly
Closing in favor of #140 |
Alternative/follow-up to #140.
This utilizes the runtime
Error
constructor parameteroptions.cause
to propagatedata.cause
. The explicit assignment of the property in #140 is preserved as fallback, which should make this change non-breaking.This requires change tsconfig
lib
fromES2020
toES2022
to be recognized. Alternatively, if allowing es2022 lib is not desired at this point, thecause
prop could be explicitly added/shadowed like in #140.Related
Based on
metamask-extension preview branch