Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the default verbosity of JS library error messages #8339

Merged
merged 2 commits into from
Mar 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,24 @@ var LibraryManager = {
processed = processMacros(preprocess(src, filename));
eval(processed);
} catch(e) {
var details = [e, e.lineNumber ? 'line number: ' + e.lineNumber : '', (e.stack || "").toString().replace('Object.<anonymous>', filename)];
var details = [e, e.lineNumber ? 'line number: ' + e.lineNumber : ''];
if (VERBOSE) {
details.push((e.stack || "").toString().replace('Object.<anonymous>', filename));
}
if (processed) {
error('failure to execute js library "' + filename + '": ' + details + '\npreprocessed source (you can run a js engine on this to get a clearer error message sometimes):\n=============\n' + processed + '\n=============\n');
error('failure to execute js library "' + filename + '": ' + details);
if (VERBOSE) {
error('preprocessed source (you can run a js engine on this to get a clearer error message sometimes):\n=============\n' + processed + '\n=============');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{, } if if/else bodies are on another line, like here and later down.

} else {
error('use -s VERBOSE to see more details')
}
} else {
error('failure to process js library "' + filename + '": ' + details + '\noriginal source:\n=============\n' + src + '\n=============\n');
error('failure to process js library "' + filename + '": ' + details);
if (VERBOSE) {
error('original source:\n=============\n' + src + '\n=============');
} else {
error('use -s VERBOSE to see more details')
}
}
throw e;
}
Expand Down