Improve error handling in curate apply-geolocation-rules#1905
Draft
corneliusroemer wants to merge 1 commit intomasterfrom
Draft
Improve error handling in curate apply-geolocation-rules#1905corneliusroemer wants to merge 1 commit intomasterfrom
curate apply-geolocation-rules#1905corneliusroemer wants to merge 1 commit intomasterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1905 +/- ##
==========================================
- Coverage 74.09% 74.06% -0.04%
==========================================
Files 82 82
Lines 8972 8980 +8
Branches 1823 1824 +1
==========================================
+ Hits 6648 6651 +3
- Misses 2019 2023 +4
- Partials 305 306 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
victorlin
requested changes
Oct 18, 2025
Comment on lines
+123
to
+126
| raise Exception( | ||
| f"Expected the next traversal target to be a string, but got {type(next_traversal_target)} instead. " + | ||
| f"Raw geolocation: {raw_geolocation}, rule traversal: {rule_traversal}. " + | ||
| f"Current rules: {current_rules}." |
Member
There was a problem hiding this comment.
Suggested rewording that points directly to the problem:
ERROR: The 'location' field has a null value. Please use an empty string ""
instead of null for missing values.
Input values:
region: ''
country: 'Democratic Republic of the Congo'
division: 'Tshopo,Yahuma'
location: null
Comment on lines
+103
to
+108
| try: | ||
| lower_field_value = field_value.lower() | ||
| except AttributeError: | ||
| print_err(f"WARNING: Could not convert {field_value!r} to lowercase.") | ||
| continue | ||
| current_rules = current_rules.get(lower_field_value) |
Member
There was a problem hiding this comment.
No need for try/except – the case of field_value not being a string should be handled elsewhere (done in this PR).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #1904
Description of proposed changes
Related issue(s)
Checklist