MCPcopy Create free account
hub / github.com/npm/cli / #handleError

Method #handleError

lib/npm.js:354–369  ·  view source on GitHub ↗
(err)

Source from the content-addressed store, hash-verified

352 }
353
354 async #handleError (err) {
355 if (err) {
356 // Get the local package if it exists for a more helpful error message
357 const localPkg = await require('@npmcli/package-json')
358 .normalize(this.localPrefix)
359 .then(p => p.content)
360 .catch(() => null)
361 Object.assign(err, this.#getError(err, { pkg: localPkg }))
362 }
363
364 this.finish(err)
365
366 if (err) {
367 throw err
368 }
369 }
370
371 #getError (rawErr, opts) {
372 const { files = [], ...error } = require('./utils/error-message.js').getError(rawErr, {

Callers 2

loadMethod · 0.95
execMethod · 0.95

Calls 2

#getErrorMethod · 0.95
finishMethod · 0.95

Tested by

no test coverage detected