-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Added useful message for thrown exception #48878
Conversation
else | ||
throw Exception(ErrorCodes::UNKNOWN_QUERY_PARAMETER, "Substitution {} is not set", backQuote(name)); | ||
else { | ||
try { |
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.
try { throw ... } catch
looks a bit silly :-) What about including all information in the exception in the first place and not using try/catch
? Alternatively, wrap the entire block in try
such that a single catch
may add all context.
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 for the feedback! Sorry this is my first time working on an open source project (or anything outside of class projects) I'll take a look and clean it up.
" because it isn't parsed completely: only {} of {} bytes was parsed: {}", | ||
value, type_name, ast_param.name, read_buffer.count(), value.size(), value.substr(0, read_buffer.count())); | ||
} | ||
catch (const Exception & e) { |
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.
Perhaps (didn't check closer) function try blocks may help: https://stackoverflow.com/questions/5612486/when-is-a-function-try-block-useful
I will rewrite. |
Issue: #48772
Added try catch blocks to catch an exception thrown, add a message about the parameter that couldn't be parsed then throw new exception.