Skip to content

Commit 9afd839

Browse files
committed
feat: ✨ update compilation error messages
1 parent a5c8f65 commit 9afd839

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ export function compile(code) {
3232
const ast = parser.parse();
3333
const compiler = new CompilerJS(stdEnv(ast));
3434
const js = makeCompilerEnv() + compiler.compile();
35-
return UglifyJS.minify(js).code;
35+
36+
const uglified = UglifyJS.minify(js);
37+
if (uglified.error) {
38+
throw EvalError(`Comppiling Error: ${uglified.error}`);
39+
} else {
40+
return uglified.code;
41+
}
3642
}
3743

3844
export function runJS(jsCode) {

0 commit comments

Comments
 (0)