10000 Surface better info on what file had an error. Part of a change in r.… · xcoderzach/requirejs@88c1723 · GitHub
[go: up one dir, main page]

Skip to content

Commit 88c1723

Browse files
committed
Surface better info on what file had an error. Part of a change in r.js to surface syntax errors that uglifyjs surfaces when trying to build an ast to find require/define calls.
1 parent dbdd50b commit 88c1723

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

require.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ var requirejs, require, define;
526526
}
527527

528528
function execManager(manager) {
529-
var i, ret, waitingCallbacks, err,
529+
var i, ret, waitingCallbacks, err, errFile,
530530
cb = manager.callback,
531531
fullName = manager.fullName,
532532
args = [],
@@ -584,10 +584,12 @@ var requirejs, require, define;
584584
}
585585

586586
if (err) {
587+
errFile = (fullName ? makeModuleMap(fullName).url : '') ||
588+
err.fileName || err.sourceURL;
587589
err = makeError('defineerror', 'Error evaluating ' +
588590
'module "' + fullName + '" at location "' +
589-
(fullName ? makeModuleMap(fullName).url : '') + '":\n' +
590-
err + '\nfileName:' + (err.fileName || err.sourceURL) +
591+
errFile + '":\n' +
592+
err + '\nfileName:' + errFile +
591593
'\nlineNumber: ' + (err.lineNumber || err.line), err);
592594
err.moduleName = fullName;
593595
return req.onError(err);

0 commit comments

Comments
 (0)
0