Versions: Nakama: 3.9
Server Framework Runtime language: TS
I am trying to design a better way of handling errors and exceptions in our TS runtime.
I am aware that TS isnt great for providing details of exceptions but am looking for a way to get the stack-trace when an exception is caught by a try-catch. At the moment i only get a general description of the error, for example…
try {
for(let x:number = 0; i < 10; x++){ }
}
catch(err){
logger.info("error-string?: "+err);
}
Would get me the log…
{“level”:“info”,“ts”:“2021-11-12T06:32:03.711Z”,“caller”:“server/runtime_javascript_logger.go:74”,“msg”:“error-string?: ReferenceError: i is not defined”}
During dev, this might be enough for me to debug the issue, but once all features are present on the backend it will be very hard to hunt down what script, function, line of code is causing the problem.
I am wondering if there is a way to grab the stack-trace of the exception when it is thrown so that the logging can be more informative?
Thanks,
Sean