MCPcopy Create free account
hub / github.com/npm/cli / syntaxErrorHandler

Function syntaxErrorHandler

lib/cli/validate-engines.js:17–26  ·  view source on GitHub ↗
(err)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 2

errorMethod · 0.80
exitMethod · 0.45

Tested by

no test coverage detected