on master help sign in
javascript: wrap exceptions in function
8915184raichoo
src/IRTS/JavaScript/AST.hs+1−1
@@ -180,7 +180,7 @@ compileJS' indent (JSNew name args) =
180 `T.append` ")"
180 `T.append` ")"
181
181
182compileJS' indent (JSError exc) =
182compileJS' indent (JSError exc) =
183− "throw new Error(\"" `T.append` T.pack exc `T.append` "\")"
183+ "(function(){throw new Error(\"" `T.append` T.pack exc `T.append` "\")})()"
184
184
185compileJS' indent (JSBinOp op lhs rhs) =
185compileJS' indent (JSBinOp op lhs rhs) =
186 compileJS' indent lhs
186 compileJS' indent lhs