This repository has been archived by the owner on Jun 29, 2023. It is now read-only.
Only the root cause stack trace is visible in filtered stack traces #99
Labels
type: enhancement
A general enhancement
Milestone
(forked from #98)
While looking at a possible fix for this I because curious about this, and writing a test case to see if I could fix it easily I realised that there is interesting logic in
Throwable.printEnclosedStackTrace()
around compressing common frames (see... 29 more
in the details below) which you lose by implementing the printing of the stack trace elements yourself. I speculated that you chose this approach to be able to easily restrict the print to the last Throwable in the chain which makes sense.When printing multiple traces though I think it would be better to simply parser / filter the Throwable output itself to get the benefit of common frame deduplication and adding the package filtering over the top. Making the depth of traces to present would be problematic with this approach as you wouldn’t know whether you were losing frames presented further up the chain which you had chosen to hide. You could solve this by only allowing positive integers and using it to compute the height in the stack to start from (perhaps interpreting 0 as the full height), but this doesn’t seem very useful.
My ‘keep it simple’ instincts suggests allowing the user to choose to invoke
Throwable.printStackTrace()
on the root cause and filter for packages or to invokeThrowable.printStackTrace()
on the first Throwable in the chain and filtering for packages.The text was updated successfully, but these errors were encountered: