1'use strict' 2var moduleName = require('../utils/module-name.js') 3var validate = require('aproba') 4 5module.exports = function (parent, cb) { 6 validate('F', [cb]) 7 return function (er) { 8 if (!er) return cb.apply(null, arguments) 9 if (er instanceof Error && parent && parent.package && parent.package.name) { 10 er.parent = moduleName(parent) 11 } 12 cb(er) 13 } 14} 15