Calling `toJSON` unsets unhandled rejection state.
See original GitHub issueUsing v3.5.0 on Chrome v57.0.2987.133
If toJSON
is called on a promise instance, the unhandled rejection state is unset.
This means that any promise that gets serialized to JSON will not be caught in an unhandled rejection event.
The expected result is that calling toJSON
makes no changes to the target instance.
Issue exploration:
toJSON
calls reason
which calls _unsetRejectionIsUnhandled
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top Results From Across the Web
resolver or addr is not configured for ENS name (argument ...
Hi! I run this code in browser, and can't catch promise rejection. Important: I added await before getContract,however in typings you return Contract, ......
Read more >React error : Unhandled Rejection (TypeError): this.state ...
The error is telling you that data in your fetch fulfillment handler is not an array. That's what you have to debug. Look...
Read more >Process | Node.js v19.3.0 Documentation
Rejections can be caught and handled using promise.catch() and are propagated through a Promise chain. The 'unhandledRejection' event is useful for detecting ...
Read more >WebDriver - W3C on GitHub
The state can be unset by providing an " acceptInsecureCerts ... Upon rejection of promise with reason r , let result be a...
Read more >2 Server Error Message Reference - MySQL :: Developer Zone
Message: BLOB, TEXT, GEOMETRY or JSON column '%s' can't have a default value ... Message: The prepared statement contains a stored routine call...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@petkaantonov yes, I understand
.reason
, but people whoJSON.stringify
an object containing a unhandled rejection promise as a side effect of logging all payloads (for example) would not expect the rejection to be silent - would they?Since the fix proposed by @benjamingr would be a breaking change, I don’t know if it’s the best approach.
One solution could be to add a config option disable JSON serialization altogether, and instead mirror the behavior of the native
Promise
object.