test/script/basic/errorstack.js
Print this page
*** 20,30 ****
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
! * "stack" property of Error objects. (nashorn extension).
*
* @test
* @run
*/
--- 20,30 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
! * "getStackTrace()" method of Error objects. (nashorn extension).
*
* @test
* @run
*/
*** 41,51 ****
}
try {
func1();
} catch (e) {
! // "stack" is java.lang.StackTraceElement object
! for (i in e.stack) {
! print(e.stack[i].methodName + " : " + e.stack[i].lineNumber);
}
}
--- 41,51 ----
}
try {
func1();
} catch (e) {
! var frames = e.getStackTrace();
! for (i in frames) {
! print(frames[i].methodName + " : " + frames[i].lineNumber);
}
}