I use stacktrace.js to get the correct stack trace on exception but I wonder if it’s possible to extract part of the code to get the context of where the exception has arisen
Is there any good and simple way to do that ?
I use stacktrace.js to get the correct stack trace on exception but I wonder if it’s possible to extract part of the code to get the context of where the exception has arisen
Is there any good and simple way to do that ?
So after reading the code the answer is yes and stacktrace already store source code in cache. We can retrieve it like that :
create a helper:
then with stacktracejs need to do like that:
and then use trace.lineNumber to extract some line before and after from sourceCode !