Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var STDOUT = java.lang.System.out;
STDOUT.println("starting test");
var body =
"function() {\n" +
"// this is a common js module\n" +
"var num = 234;\n" +
"num.substr(1, 1);\n" +
"}\n// #sourceURL=wibble.js";
STDOUT.println("module source is:\n" + body);
var f = eval(body);
try {
f();
} catch (ex) {
if (ex instanceof TypeError) {
STDOUT.println("message is:" + ex.message);
STDOUT.println("line no is:" + ex.lineNumber);
STDOUT.println("filename is:" + ex.fileName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.