-
-
Notifications
You must be signed in to change notification settings - Fork 746
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
ST2api Log Fix So That Querying a Non-Existent Key in the Datastore Will Not Print Traceback #4981
Conversation
Currently exceptions raised are re-thrown in router.py and then caught higher up.
One possible solution would be to keep the throw of StackStormDBObjectNotFoundError. Then add an explicit catch next to https://github.com/StackStorm/st2/blob/master/st2common/st2common/router.py#L514-L519 for the StackStormDBObjectNotFoundError, still re-raise so you get the http response code handling as before. But rather than use a LOG.exception use a LOG that just logs the exception msg, rather than the full stack trace. |
@amanda11 +1 for that solution |
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.
Looks good, but I wonder if warning rather than error would be more appropriate? But I don’t know if that would normally come out or not - but if they did it maybe is more a warning than an error?
I also was originally thinking you would want to still include the text that was in the log.exception call, eg keep the “Failed to call the controller ...” message with its parameters, and just add on the exception msg as well - rather than just the exception message.
Oh. Okay, right. That sounds better. |
I think I've found a problem with making it extend base exception. There are a number of calls made to get_by_scope_and_name that check if the DBObjectNotFoundError is returned and act on it. So I think by changing it to a new exception (that doesn't extend DbObjectNotFoundError) then we will break these, e.g. So I think it might be better to change this new exception to extend DBObjectNotFoundError. |
That's not you. It's a known test that occassionally runs slow.... We've not yet worked out how to resolve this one. |
@saucetray There is however a lint error that needs fixing ". virtualenv/bin/activate; flake8 --config ./lint-configs/python/.flake8 st2actions st2api st2auth st2client st2common st2debug st2exporter st2reactor st2stream st2tests |
oh yeah I fixed that already I'm seeing if there's any other errors before I start this |
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.
Thanks @saucetray
Co-authored-by: Eugen C. <[email protected]>
@armab @punkrokk @amanda11 that's the log now... maybe it should be pretty printed better? |
At least it shouldn't print some information 2 times in one message. |
LGTM |
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.
Indentation not quite fixed.
Co-authored-by: blag <[email protected]>
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.
LGTM!
Thanks @saucetray for the PR, @amanda11 for review and @punkrokk @blag for the pointers!
ST2api.log will print a traceback when you attempt to query a non-existent key in the datastore. This should fix that.
Fixes #4979