Skip to content

Instantly share code, notes, and snippets.

@qmx
Last active August 29, 2015 13:57
Show Gist options
  • Save qmx/9712339 to your computer and use it in GitHub Desktop.
Save qmx/9712339 to your computer and use it in GitHub Desktop.
Error
at foo (<eval>:1)
at <eval> (<eval>:1)
at <eval> (:-1)
Error
at baz (<eval>:1)
at <stack-getter> (<eval>:1)
at <eval> (:-1)
/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/java -ea -Didea.launcher.port=7544 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 13.app/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA 13.app/lib/idea_rt.jar:/Applications/IntelliJ IDEA 13.app/plugins/junit/lib/junit-rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/htmlconverter.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Volumes/v2/git/dynjs/target/test-classes:/Volumes/v2/git/dynjs/target/classes:/Users/qmx/.m2/repository/me/qmx/jitescript/jitescript/0.3.1/jitescript-0.3.1.jar:/Users/qmx/.m2/repository/org/ow2/asm/asm-all/4.1/asm-all-4.1.jar:/Users/qmx/.m2/repository/org/easytesting/fest-assert/1.4/fest-assert-1.4.jar:/Users/qmx/.m2/repository/org/easytesting/fest-util/1.1.6/fest-util-1.1.6.jar:/Users/qmx/.m2/repository/com/google/guava/guava/14.0.1/guava-14.0.1.jar:/Users/qmx/.m2/repository/org/projectodd/rephract/rephract/1.1.0/rephract-1.1.0.jar:/Users/qmx/.m2/repository/com/headius/invokebinder/1.2/invokebinder-1.2.jar:/Users/qmx/.m2/repository/args4j/args4j/2.0.16/args4j-2.0.16.jar:/Users/qmx/.m2/repository/org/jboss/aesh/aesh/0.38/aesh-0.38.jar:/Users/qmx/.m2/repository/org/fusesource/jansi/jansi/1.9/jansi-1.9.jar:/Users/qmx/.m2/repository/com/headius/options/1.0/options-1.0.jar:/Users/qmx/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.9/jackson-core-asl-1.9.9.jar:/Users/qmx/.m2/repository/org/jruby/joni/joni/2.1.0/joni-2.1.0.jar:/Users/qmx/.m2/repository/org/jruby/jcodings/jcodings/1.0.8/jcodings-1.0.8.jar:/Users/qmx/.m2/repository/com/github/jnr/jnr-posix/3.0.1/jnr-posix-3.0.1.jar:/Users/qmx/.m2/repository/com/github/jnr/jnr-ffi/1.0.7/jnr-ffi-1.0.7.jar:/Users/qmx/.m2/repository/com/github/jnr/jffi/1.2.7/jffi-1.2.7.jar:/Users/qmx/.m2/repository/com/github/jnr/jffi/1.2.7/jffi-1.2.7-native.jar:/Users/qmx/.m2/repository/org/ow2/asm/asm/4.0/asm-4.0.jar:/Users/qmx/.m2/repository/org/ow2/asm/asm-commons/4.0/asm-commons-4.0.jar:/Users/qmx/.m2/repository/org/ow2/asm/asm-tree/4.0/asm-tree-4.0.jar:/Users/qmx/.m2/repository/org/ow2/asm/asm-analysis/4.0/asm-analysis-4.0.jar:/Users/qmx/.m2/repository/org/ow2/asm/asm-util/4.0/asm-util-4.0.jar:/Users/qmx/.m2/repository/com/github/jnr/jnr-x86asm/1.0.2/jnr-x86asm-1.0.2.jar:/Users/qmx/.m2/repository/com/github/jnr/jnr-constants/0.8.5/jnr-constants-0.8.5.jar:/Users/qmx/.m2/repository/junit/junit/4.8.2/junit-4.8.2.jar:/Users/qmx/.m2/repository/org/mockito/mockito-core/1.8.5/mockito-core-1.8.5.jar:/Users/qmx/.m2/repository/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar:/Users/qmx/.m2/repository/org/objenesis/objenesis/1.0/objenesis-1.0.jar:/Users/qmx/.m2/repository/io/netty/netty/3.6.1.Final/netty-3.6.1.Final.jar:/Users/qmx/.m2/repository/com/github/akiellor/jasmine/jasmine-cli/0.0.12/jasmine-cli-0.0.12.jar:/Users/qmx/.m2/repository/com/github/akiellor/jasmine/jasmine-core/0.0.12/jasmine-core-0.0.12.jar" com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 org.dynjs.runtime.StackTraceTest,testStackCleanup
Error
at foo (<eval>:1)
at <eval> (<eval>:1)
at <eval> (:-1)
Error
at baz (<eval>:1)
at <stack-getter> (<eval>:1)
at <eval> (:-1)
Error
at waz (<eval>:1)
at <stack-getter> (<eval>:1)
at <eval> (:-1)
Process finished with exit code 0
@Test
public void testStackCleanup() {
DynObject e = (DynObject) (eval("function foo() { return new Error(); }; foo();"));
String stack = (String) e.get(getContext(), "stack");
System.out.println(stack);
assertThat(stack.split("\n").length).isEqualTo(4);
DynObject e2 = (DynObject) (eval("function baz() { return new Error(); }; baz();"));
String stack2 = (String) e2.get(getContext(), "stack");
System.out.println(stack2);
assertThat(stack2.split("\n").length).isEqualTo(4);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment