Skip to content

Commit

Permalink
chore: fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobdadams committed Jul 21, 2023
1 parent c4c6cf0 commit 806eced
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/palletjack/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def switch_to_nullable_int(dataframe, fields_that_should_be_ints):
try:
for field in fields_that_should_be_ints:
retyped[field] = DataCleaning._switch_series_to_numeric_dtype(retyped[field], 'Int64')
except ValueError as error:
except (TypeError, ValueError) as error:
raise TypeError(
'Cannot convert one or more fields to nullable ints. Check for non-int/non-np.nan values.'
) from error
Expand All @@ -214,7 +214,7 @@ def switch_to_float(dataframe, fields_that_should_be_floats):
try:
for field in fields_that_should_be_floats:
retyped[field] = DataCleaning._switch_series_to_numeric_dtype(retyped[field], 'float')
except ValueError as error:
except (TypeError, ValueError) as error:
raise TypeError(
'Cannot convert one or more fields to floats. Check for non-float/non-null values.'
) from error
Expand Down

0 comments on commit 806eced

Please sign in to comment.