Description
electron-unhandled catches unhandled errors and promise rejections in an Electron app, so they are reported instead of failing silently. You can use it in the main process and in renderer processes. The module must be bundled into the renderer code or loaded from a preload script, and it has to be able to reach the main process. The README warns that a preload script with contextIsolation on, which is the Electron default, does not receive errors from the page. To catch those, set contextIsolation to false, or catch the errors in the page and send them to the main process yourself. Handlers are registered by the unhandled() call and are not added to windows created later, so you call it in the code of each window. An ES module preload script needs sandbox set to false. The README says a renderer that crashes or stops responding is also reported, but the error has no stack trace of your app, so the dialog shows only the message. The module requires Electron 44 or later. The source is public on GitHub.…
Highlights
- Catches unhandled errors and promise rejections
- Works in the main process and renderer processes
- Reports crashed or unresponsive renderers
- Shows a dialog with the error message
- Requires Electron 44 or later
Ratings & Reviews
No ratings yet
Be the first to rate Electron Unhandled.
People also visit
Electron Unhandled FAQ
What does electron-unhandled do?
It catches unhandled errors and promise rejections in an Electron app, and shows them in a dialog.
Which Electron version does it need?
Electron 44 or later, according to the README.
Do I call it in the main process?
Yes, at minimum. The README also suggests calling it in each window's code so renderer errors are caught.
Why don't I see page errors from my preload script?
With contextIsolation on, which is the Electron default, a preload script does not receive errors from the page. The README suggests setting contextIsolation to false, or catching the errors in the page.
Does the error include a stack trace?
No. The README says the reported error has no stack trace of your app, so the dialog shows the message only.
What are the best Electron Unhandled alternatives?
Popular alternatives to Electron Unhandled include Desktop App, Packager and electron-trpc. See all Electron Unhandled alternatives


