How to get stacktrace and/or linenumber from java in an async js function
We have async js functions making calls into java-land to log events, with regular functions this works fine and I can get the linenumber of the calling script like this (if there's a better way I'd love to hear about that too):
int line = -1;
Throwable t = new RuntimeException();
TruffleStackTrace.fillIn(t);
List<TruffleStackTraceElement> trace = TruffleStackTrace.getStackTrace(t);
for (TruffleStackTraceElement elm : trace) {
Node node = elm.getLocation();
if (node != null) {
line = node.getEncapsulatingSourceSection().getStartLine();
break;
}
}
This however doesn't work in a callback from an async function, is it possible to do this and if so how ?
I'm using Temurin JDK 21 + Graal 23.1.1
Hi, Thank you for reaching out, could you please share a full reproducer of the issue so we can look into it? Thank you
Hi, any update?
Hi sorry, been super busy - will try to get a reproducible case added here soon
I'll close this ticket for inactivity. If you managed to get a reproducer please create a new ticket on this project or the main project: https://github.com/oracle/graal and we'll take a second look at it. Thank you