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

improve error messages #516

Merged
merged 1 commit into from Nov 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/scope.js
Expand Up @@ -318,7 +318,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
return !(sym instanceof AST_SymbolLet || sym instanceof AST_SymbolConst);
})) {
js_error(
node.name + " redeclared",
`"${node.name}" is redeclared`,
node.start.file,
node.start.line,
node.start.col,
Expand All @@ -345,7 +345,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
}
if (!(scope instanceof AST_Toplevel) && (node instanceof AST_Export || node instanceof AST_Import)) {
js_error(
node.TYPE + " statement may only appear at top level",
`"${node.TYPE}" statement may only appear at the top level`,
node.start.file,
node.start.line,
node.start.col,
Expand Down
2 changes: 1 addition & 1 deletion test/mocha/minify.js
Expand Up @@ -356,7 +356,7 @@ describe("minify", function() {
result = Terser.minify(code);
var err = result.error;
assert.ok(err instanceof Error);
assert.strictEqual(err.stack.split(/\n/)[0], "SyntaxError: a redeclared");
assert.strictEqual(err.stack.split(/\n/)[0], `SyntaxError: "a" is redeclared`);
});
});
});
Expand Down