/usr/lib/node_modules/npm/lib/utils
const log = require('./log-shim') // print an error or just nothing if the audit report has an error // this is called by the audit command, and by the reify-output util // prints a JSON version of the error if it's --json // returns 'true' if there was an error, false otherwise const auditError = (npm, report) => { if (!report || !report.error) { return false } if (npm.command !== 'audit') { return true } const { error } = report // ok, we care about it, then log.warn('audit', error.message) const { body: errBody } = error const body = Buffer.isBuffer(errBody) ? errBody.toString() : errBody if (npm.flatOptions.json) { npm.output(JSON.stringify({ message: error.message, method: error.method, uri: error.uri, headers: error.headers, statusCode: error.statusCode, body, }, null, 2)) } else { npm.output(body) } throw 'audit endpoint returned an error' } module.exports = auditError
.
Edit
..
Edit
ansi-trim.js
Edit
audit-error.js
Edit
cmd-list.js
Edit
completion
Edit
completion.sh
Edit
config
Edit
did-you-mean.js
Edit
display.js
Edit
error-message.js
Edit
exit-handler.js
Edit
explain-dep.js
Edit
explain-eresolve.js
Edit
format-bytes.js
Edit
format-search-stream.js
Edit
get-identity.js
Edit
is-windows.js
Edit
log-file.js
Edit
log-shim.js
Edit
npm-usage.js
Edit
open-url-prompt.js
Edit
open-url.js
Edit
otplease.js
Edit
ping.js
Edit
pulse-till-done.js
Edit
queryable.js
Edit
read-user-info.js
Edit
reify-finish.js
Edit
reify-output.js
Edit
replace-info.js
Edit
tar.js
Edit
timers.js
Edit
update-notifier.js
Edit
validate-lockfile.js
Edit
web-auth.js
Edit