Skip to content

Commit 3fa5f02

Browse files
jamiebuildsljharb
authored andcommitted
[Fix] Create error outside process.nextTick
This creates much more relevant stack traces for user input errors
1 parent 3325ec1 commit 3fa5f02

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/async.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ module.exports = function resolve (x, opts, cb) {
1212
}
1313
if (!opts) opts = {};
1414
if (typeof x !== 'string') {
15+
var err = new TypeError('path must be a string');
1516
return process.nextTick(function () {
16-
cb(new Error('path must be a string'));
17+
cb(err);
1718
});
1819
}
1920

0 commit comments

Comments
 (0)