fromLog.error = function newError(error, path) { oldError.apply(this, arguments); if (path) { error.path = path; } that.error(error, function() { then(error); }); };