tra-analysis/website/node_modules/npm/lib/install/and-add-parent-to-errors.js

14 lines
324 B
JavaScript
Raw Normal View History

2019-01-06 19:14:45 +00:00
'use strict'
var validate = require('aproba')
module.exports = function (parent, cb) {
validate('F', [cb])
return function (er) {
if (!er) return cb.apply(null, arguments)
if (er instanceof Error && parent && parent.package && parent.package.name) {
er.parent = parent.package.name
}
cb(er)
}
}