-
Notifications
You must be signed in to change notification settings - Fork 33
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
shouldn't showing stack traces (a la --debug) be the default behaviour? #220
Comments
I agree with this, and always disliked the error message only without a stack trace by default. But, this comes from the default behavior in cliff and I do not know if there is a way to change how cliff behaves on this. If there is I'm definitely in favor of making sure we always print stack traces on unhandled exceptions |
@mtreinish commented on 29 Jan 2019, 17:43 GMT:
Well, as you well know cliff is Open Source maintained by excellent folks ;-) So I think we can confidently say there is a way to change how cliff behaves on this, even if that way requires some code changes :-) Based on a quick glance it appears to have been added here: so it's time to chat with @dhellmann - I'm sure he had a good reason for adding it :-) Maybe we can catch him in IRC. |
Stack traces are a terrible way to report an error to a normal application user, so I don't think we want to change the default behavior in cliff. If you wanted to change the default for stestr, then we could update cliff to make it possible to override the default. It may already be possible to do that by modifying self.options.debug in the initialize_app() method, so give that a try first. |
By default cliff suppresses stack traces on unhandled exceptions in order to keep the output cleaner for users. But in practice this has caused more confusion for stestr users since often the error messages aren't really descriptive enough to indicate what's going wrong (or that it's even a bug in stestr). This is often because exception messages are written assuming the context of the stack trace for debugging, not to be user facing messages. Cliff offers the --debug flag to enable printing the full stack traces. This commit turns that flag on by default when stestr initializes the cliff App object to ensure that it always prints the full stack trace on an unhandled exception. Fixes #220
@dhellmann commented on January 30, 2019 3:52 PM:
Yes, but as stated in IRC, I think a cryptic one-liner like So here's an idea for how we could do even better:
Of course since this is handled in cliff, we'd want a way for application writers to customise the error message. @dhellmann Would you consider a patch to implement this? |
Also, specifying the URL of an issue tracker could be optional for the application author, in which case the default error template could automatically adjust depending on whether it's provided or not. |
I actually did something similar in another program of mine a long time ago, where there was even the possibility to guess that the crash was associated with known bugs: |
Issue description
As mentioned in #219, it is possible to cause
stestr
to crash with an errormin() arg is an empty sequence
, but with no stacktrace. Adding--debug
gives the stacktrace, but this begs the question - why are stack traces being hidden by default? It gives the false impression that a crash such as this one was the fault of the user, but as a result the error message will focus on something which went wrong internally, and as a result will generally appear cryptic to the user.Steps to reproduce the problem
Exploit a bug such as the one mentioned in #219 in order to cause
stestr
to crash.Expected behavior
The stacktrace is shown, making it obvious that this was a crash not a usage error caused by the end user.
Actual behavior
Only the error message is shown, with no indication the user hit a bug in
stestr
.Specifications like the version of the project, operating system, or hardware
Same as in #219.
The text was updated successfully, but these errors were encountered: