Skip to content

Commit

Permalink
Catch ValueError, ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
jarofgreen committed Jan 7, 2025
1 parent 4c553cb commit fcd2969
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions iati_datastore/iatilib/frontend/serialize/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,14 @@ def description_most_general(all_values):
"""Select most general description type, lowest type code (as integer) wins"""
out = None
for desc_type in all_values:
if not out:
out = desc_type
elif int(desc_type) < int(out):
out = desc_type
try:
if not out:
out = desc_type
elif int(desc_type) < int(out):
out = desc_type
except ValueError:
# https://github.com/codeforIATI/iati-datastore/issues/409
pass
return all_values[out]

def select_description_type(all_values, desc_type_name):
Expand Down

0 comments on commit fcd2969

Please sign in to comment.