-
Notifications
You must be signed in to change notification settings - Fork 130
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
filter: Handle errors from filter_by_query
#942
filter: Handle errors from filter_by_query
#942
Conversation
Codecov Report
@@ Coverage Diff @@
## master #942 +/- ##
========================================
Coverage 59.34% 59.34%
========================================
Files 42 50 +8
Lines 6011 6257 +246
Branches 1539 1584 +45
========================================
+ Hits 3567 3713 +146
- Misses 2185 2283 +98
- Partials 259 261 +2
Continue to review full report at Codecov.
|
f339f40
to
62c21fc
Compare
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.
Great to do this sort of nicer error handling! A few minor notes; nothing truly blocking if you object.
- The underlying pandas engine used for --query can raise various errors depending on the input. - The query call is invoked by a loop through all filtering functions. Based on the above points, this change wraps the line executing filter functions and catches all errors, but only handles the errors from filter_by_query. For the errors from filter_by_query, the UndefinedVariableError is predictable enough to mean that a column does not exist. For all other errors, raise a generic error message directing users to the pandas query syntax doc page.
62c21fc
to
d1a063a
Compare
@tsibley thanks for the pointers! Will merge when checks pass. |
Description of proposed changes
--query
can raise various errors depending on the input.Based on the above points, this change wraps the line executing filter functions and catches all errors, but only handles the errors from filter_by_query.
For the errors from filter_by_query, the
UndefinedVariableError
is predictable enough to mean that a column does not exist. For all other errors, raise a generic error message directing users to the pandas query syntax doc page.Related issue(s)
UndefinedVariableError
/KeyError
when using--query
with a non-existent column #939ValueError
when using--query
with=
#940SyntaxError
when using--query
with bad syntax #941Testing
Added functional tests.