-
-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[errors-] options.debug_stacktrace_full for more callstack #2586
base: develop
Are you sure you want to change the base?
Conversation
@@ -3,6 +3,7 @@ | |||
from visidata import vd, VisiData | |||
|
|||
vd.option('debug', False, 'exit on error and display stacktrace') | |||
vd.option('debug_stacktrace_full', False, 'for exceptions, show callstack levels above the catch') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need an option for this? It seems like it would be fine to include the extra levels always.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my own use, I'd want the extra levels always. And I'd rather not create another unnecessary option.
My concerns would be, will long stack traces be annoying or intimidating for newer users? And will they find them difficult to copy/paste for bug reports?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the top format better, without the ^^^^
. Can they both be in the same format? Also can we have the more relevant stacktrace first? It's usually the inner one, which is the second one in the example you showed.
I don't mind if these errors messages are annoying for newer users; this is one of the reasons that error sheets are bound to Ctrl+E and not Shift+E (Ctrl being more "system" focused). But I agree that longer stack traces are less ideal for copy/pasting into bug reports. As long as it's only 2-3x as large I hope it's not too onerous. Maybe we could use options.disp_expert > 1
or something? In any event let's omit the extra option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can match the format to get rid of the carets.
Since stacktraces sometimes show up on stdout of visidata, I would worry about that output being overwhelming. And a bit confusing, because if users copy the text there, they will likely not expect the unusual stack trace ordering.
What if we just print one long stacktrace (the full output of format_stack()
) for all exceptions? And handle one case specially: the most common case, where errors occur in mainloop.py
? We can get rid of the line ret = vd.mainloop(scr)
and everything above it. It's quite a dirty solution, but it would get rid of 16 lines of stack trace.
This PR is an aid to debugging. It adds more levels to the usual exception traceback, when an option is set.
Why this is useful: when viewing an exception trace, Python only shows the stack trace to the level of the function that caught the exception. Often such an exception trace will top out with a common wrapper function like
wrapply()
orcallNoExceptions()
. And that's too ambiguous to identify the line causing a bug.Here is some sample output to show the effect. I've split it into two parts. The top part is the new extra output, the bottom is the usual exception trace. The full trace doubles the length of the traceback, as well as having a different format. So it's good to default off for most users.