Created
February 18, 2015 12:42
-
-
Save purplefox/60619067006c3cc3eaee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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