/opt/alt/alt-nodejs24/root/usr/lib/node_modules/npm/lib/utils
const { log, output } = require('proc-log') const { redactLog: replaceInfo } = require('@npmcli/redact') // 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) { output.buffer({ message: error.message, method: error.method, uri: replaceInfo(error.uri), headers: error.headers, statusCode: error.statusCode, body, }) } else { output.standard(body) } throw 'audit endpoint returned an error' } module.exports = auditError
.
Edit
..
Edit
audit-error.js
Edit
auth.js
Edit
cmd-list.js
Edit
completion.fish
Edit
completion.sh
Edit
did-you-mean.js
Edit
display.js
Edit
error-message.js
Edit
explain-dep.js
Edit
explain-eresolve.js
Edit
format-bytes.js
Edit
format-search-stream.js
Edit
format.js
Edit
get-identity.js
Edit
get-workspaces.js
Edit
installed-deep.js
Edit
installed-shallow.js
Edit
is-windows.js
Edit
log-file.js
Edit
npm-usage.js
Edit
oidc.js
Edit
open-url.js
Edit
output-error.js
Edit
ping.js
Edit
queryable.js
Edit
read-user-info.js
Edit
reify-finish.js
Edit
reify-output.js
Edit
sbom-cyclonedx.js
Edit
sbom-spdx.js
Edit
tar.js
Edit
timers.js
Edit
update-workspaces.js
Edit
validate-lockfile.js
Edit
verify-signatures.js
Edit