Using the following snippet, will swallow unhandled rejections if the promise is rejected after being inspected by Note: in the browser I used the following events to check if the unhandled rejection event is raised, which it wasn't: This behavior is seen in both Node and browsers I have tested it on the following platforms: Win11 Chrome Version 122.0.6261.129 Win11 Firefox Version 123.0.1 macOS Sonoma 14.4 Chrome Version 122.0.6261.129 macOS Sonoma 14.4 Firefox Version 123.0.1 macOS Sonoma 14.4 Safari Version 17.4 (19618.1.15.11.12) Node versions v18.16.1 and v20.11.0 on both Win11 and macOS Sonoma 14.4
Using the function in a browser will not trigger the event. This seems to happen because of the , by default when the arg is omitted its set to , and with this configuration the unhandled rejection is still swallowed by . Changing the delay to instead of fixed it for me. The fix: Note: on Firefox you get a in the Dev Tools but it doesn't trigger the event. !image I have tested this behavior on these platforms: Win11 Chrome Version 122.0.6261.129 Win11 Firefox Version 123.0.1 macOS Sonoma 14.4 Chrome Version 122.0.6261.129 macOS Sonoma 14.4 Firefox Version 123.0.1 macOS Sonoma 14.4 Safari Version 17.4 (19618.1.15.11.12)
Repository: sindresorhus/p-state. Description: Inspect the state of a promise Stars: 134, Forks: 7. Primary language: JavaScript. License: MIT. Topics: inspect, introspection, npm-package, promise. Open PRs: 0, open issues: 0. Last activity: 9mo ago. Top contributors: sindresorhus, Richienb.