| 15 | // coverage ignored because this is only hit in very unsupported node versions and it's a best effort attempt to show something nice in those cases |
| 16 | /* istanbul ignore next */ |
| 17 | const syntaxErrorHandler = (err) => { |
| 18 | if (err instanceof SyntaxError) { |
| 19 | // eslint-disable-next-line no-console |
| 20 | console.error(`${brokenMessage}\n\nERROR:`) |
| 21 | // eslint-disable-next-line no-console |
| 22 | console.error(err) |
| 23 | return process.exit(1) |
| 24 | } |
| 25 | throw err |
| 26 | } |
| 27 | |
| 28 | process.on('uncaughtException', syntaxErrorHandler) |
| 29 | process.on('unhandledRejection', syntaxErrorHandler) |