-
Notifications
You must be signed in to change notification settings - Fork 127
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 helpful error if filter query string malformed #1232
base: master
Are you sure you want to change the base?
Conversation
Resolves #1230 filter: Improperly handled `ValueError: not enough values to unpack (expected 2, got 1)` in ` _parse_filter_query`
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1232 +/- ##
==========================================
- Coverage 68.87% 68.85% -0.03%
==========================================
Files 64 64
Lines 6937 6938 +1
Branches 1693 1693
==========================================
- Hits 4778 4777 -1
- Misses 1854 1855 +1
- Partials 305 306 +1
☔ View full report in Codecov by Sentry. |
@corneliusroemer The exclude-where/include-where syntax was never designed to be a full-featured query syntax, but you could use the I agree though that the error message could be improved! As part of the hint here, you might recommend the query flag as an alternative approach... |
op = operator.ne | ||
split_query = re.split(r'!?=', query) | ||
if len(split_query) != 2: | ||
raise AugurError(f"Invalid filter query `{query}`. Hint: Queries must follow the pattern of `property=value` or `property!=value`.") |
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.
+1 for @huddlej's suggestion. Example:
raise AugurError(f"Invalid filter query `{query}`. Hint: Queries must follow the pattern of `property=value` or `property!=value`.") | |
raise AugurError(f"Invalid filter query `{query}`. Hint: Queries must follow the pattern of `property=value` or `property!=value`. `--query` supports more complex queries.") |
Resolves #1230
filter: Improperly handled
ValueError: not enough values to unpack (expected 2, got 1)
in_parse_filter_query
Description of proposed changes
Validate, and raise error with helpful warning if the query string is malformed, rather than raising unhelpful Value Error
New error output:
Testing
What steps should be taken to test the changes you've proposed?
If you added or changed behavior in the codebase, did you update the tests, or do you need help with this?
Checklist