在Electron应用中捕获未处理的错误和promise rejections

在Electron应用中捕获未处理的错误和promise rejections

Node.js 其它杂项

访问GitHub主页

共297Star

详细介绍

electron-unhandled Build Status

Catch unhandled errors and promise rejections in your Electron app

You can use this module directly in both the main and renderer process.

Install

$ npm install --save electron-unhandled

Usage

const unhandled = require('electron-unhandled');

unhandled();

API

unhandled([options])

You probably want to call this both in the main process and any renderer processes to catch all possible errors.

options

Type: Object

logger

Type: Function
Default: console.error

Custom logger that receives the error.

Can be useful if you for example integrate with Sentry.

showDialog

Type: boolean
Default: true

Present an error dialog to the user.

Related

License

MIT © Sindre Sorhus