-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Report function name for unknown exceptions during execution #14987
Report function name for unknown exceptions during execution #14987
Conversation
This reverts commit e922c82.
throw e; | ||
} | ||
catch (Exception e) { | ||
throw DruidException.defensive().build(e, "Invocation of function '%s' encountered exception.", name); |
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 think some other category would make more sense than "defensive". Defensive is sort of like an assert (it signals that we believe this should never happen unless there's a bug) but we do in fact expect functions to throw exceptions under "normal" conditions sometimes. (Like if they receive arguments of the wrong type, etc)
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 case the invoked function have already thrown out some reasonable exception (DruidException
) - that's not touched at all - because a catch above caught it.
I wanted to add this to catch cases in which some unexpected issue happened while the function was processing....so that we don't let out a NullPointerException
; instead say that "Invocation of function x encountered ... " - it may give some help to the user what might have been the problem ; and it could give better error message to support instead of just refering to it as an NPE.
or do you think it would be better to repackage also normal DruidExcpetion
-s and re-packaged? - and rethrown them with a bit more context?
so it will be something like:
DruidException: while invoking function x
caused by:
DruidException: Can't process an empty set because it Sunday!
``
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.
Ah I see. I thought this was wrapping all exceptions, but misread it.
In the case I'm wondering if the "user-caused" exceptions (bad input) thrown by functions are all proper DruidExceptions? In that case a defensive might make sense here. We just want to avoid defensive for anything that isn't a code bug on our end.
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 - other exceptions are good; the case was like: an unexpected issue happened - and the NPE bubbled up to the top. Giving little-to-no detail to the user about what happened; as the message didn't contained anything usefull.
I think if the user could see a bit friendlier message - it might give a starting point to either start narrowing it down the issue; or try to work it around
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.
It should surface as runtime_failure IMO. Both defensive and runtime_failure map to same error code.
I've re-run the tests - and they seem to be green @gianm Could you please take another look? |
…14987) * provide function name when unknown exceptions are encountered * fix keywords/etc * fix keywrod order - regex excercise * add test * add check&fix keywords * decoupledIgnore * Revert "decoupledIgnore" This reverts commit e922c82. * unpatch Function * move to a different location * checkstyle
In case some unexpected issue happens in one of the
Function
-s the exception may get out without being wrapped in a more informational message.Which may lead to that users see
NullPointerException
after executing a query which doesn't really give any detail how to continue.These changes wrap these most likely unexpected exception in a "exception happened in function X" cover; so that the error might be a bit more specific where the issue happened.