-
Notifications
You must be signed in to change notification settings - Fork 24
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
Notice.py initialiser should use str in message #79
Comments
I have another problem with Notice.init, where it attempts to fetch the last exc_info() to get a traceback, regardless if it is currently in an exception handler or not. The result is that if do something like:
Then my message gets overwritten with 'blah' and the stack trace points to the handled exception. It would be more useful if init only searched for exc_info if it was passed an exception object, or otherwise had a way of invoking the string-only code path. This came to light because gunicorn frequently has a "Resource temporarily unavailable" exception in exc_info, and calling the airbrake library anywhere after that will report it instead of the string error provided. |
Relevant: https://stackoverflow.com/a/31921513 |
Yes, I've been working around it by wrapping my airbrake invocation when passed a string to convert the string into an exception. The resulting stack trace is useless, but the point was to not have a stack trace at all, so no big loss.
|
In your example above, I definitely agree that if your message
I think this is actually subjective, or at the very least, differs between python versions. From the stack overflow answer:
I don't know of any other way to determine whether an exception is currently being handled other than by calling I think the behavior for the airbrake client in this case is worth contemplating for sure... One question I have, is it possible to post an event to airbrake without a stack trace? If that is possible, then I would agree you should be able to push events to airbrake through this client without wondering whether python thinks there is relevant |
I believe the stack trace is required, though I have not tested it. This module attempts to enter a stub backtrace if only a string is provided: airbrake-python/airbrake/notice.py Line 66 in eff66c6
I am not too worried about suppressing the stack trace. I agree that a flag argument to notify() to suppress it and use the stub instead would be nice, but not all that critical. However, I think that if a custom string is passed to notify(), it should absolutely use that instead of the message in the exception. |
From #76 (comment)
When passed a string, I think the initialiser should use that in the error
message
. More generally, we could probably clean up__init__
innotice.py
so that it's more clear what it's doing.The text was updated successfully, but these errors were encountered: