git-stacktrace icon indicating copy to clipboard operation
git-stacktrace copied to clipboard

Unable to parse traceback

Open joejackson1993 opened this issue 2 years ago • 4 comments

I'm trying to use this with a java stack trace, which I think is supported. However, I'm getting an error.

Traceback (most recent call last): File "/usr/local/bin/git-stacktrace", line 10, in sys.exit(main()) File "/Library/Python/3.8/site-packages/git_stacktrace/cmd.py", line 78, in main traceback = api.parse_trace(blob) File "/Library/Python/3.8/site-packages/git_stacktrace/parse_trace.py", line 254, in parse_trace raise ParseException("Unable to parse traceback") git_stacktrace.parse_trace.ParseException: Unable to parse traceback

This is my example stack trace copied from intelliJ substituteVariables:1779, StringUtil (com.company.util) substituteVariables:1857, StringUtil (com.company.util) substituteVariables:1834, StringUtil (com.company.util) substituteVariableWithNullMethodReturnsEmptyString:439, StringUtilTest (com.company.util)

joejackson1993 avatar Aug 04 '22 15:08 joejackson1993

Thanks for the bug report, java support definitely has a some edge cases remaining. If you can provide a full (synthetic?) stack trace that is currently failing I can look into it further.

The format I have been testing against is something like this (from current tests), so looking for the first line and the 'at' lines

java.io.FileNotFoundException: foo (The system cannot find the file specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.(FileInputStream.java:106)
        at com.devdaily.tests.ExceptionTest.(ExceptionTest.java:15)
        at com.devdaily.tests.ExceptionTest.main(ExceptionTest.java:36)

jogo avatar Aug 05 '22 16:08 jogo

ok, so having the 'at' helped me get passed the error but the tool still isn't working for me.

❯ git stacktrace --since=20.day < ~/Documents/stack1.txt
commit range: 62dc2d4285835fd88e118b20b5df4a6c2b80e43c..0b50b0a989ed1d705cab6ad0eca9953f39fdf658
java.lang.Exception: Dump The Stack
        at com.glide.util.Log.dumpStack(Log.java:376)
        at com.glide.util.Log.dumpStack(Log.java:367)
        at com.glide.util.StringUtil.substituteVariables(StringUtil.java:1855)
        at com.glide.util.StringUtil.substituteVariables(StringUtil.java:1841)
        at com.glide.util.StringUtil.substituteVariables(StringUtil.java:1830)

No matches found

I made changes to those files 8 days so I'm not sure why it didn't detect them.

joejackson1993 avatar Aug 09 '22 13:08 joejackson1993

It would also be a great enhancement if this could work without other formats. Specifically when copying the stack from a debugger like intelliJ.

joejackson1993 avatar Aug 09 '22 13:08 joejackson1993

Unfortunately the only way I know how to debug why a match wasn't found is by being able to locally reproduce the issue. which means having a copy of the repo and the trace.

As for the trace format I personally haven't used intelliJ, so am not familiar with exactly what it does or what format it uses. That being said adding support for this format sounds like a nice enchainment, if you are interested in contributing it.

jogo avatar Aug 09 '22 16:08 jogo