Skip to content

Commit

Permalink
catch exceptions explicitly.
Browse files Browse the repository at this point in the history
  • Loading branch information
MahmoudAlamar03 committed Nov 14, 2024
1 parent 9549e6c commit 9062ba4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions resqpy/olio/read_nexus_fault.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ def is_number(s):
outdata[mask] = np.concatenate(d_elems)
df = pd.DataFrame(outdata)
for column in df.columns:
df[column] = pd.to_numeric(df[column])
try:
df[column] = pd.to_numeric(df[column])
except ValueError:
pass

Check warning on line 70 in resqpy/olio/read_nexus_fault.py

View check run for this annotation

Codecov / codecov/patch

resqpy/olio/read_nexus_fault.py#L69-L70

Added lines #L69 - L70 were not covered by tests
df.columns = ['i1', 'i2', 'j1', 'j2', 'k1', 'k2', 'mult']
df['grid'] = grid
df['name'] = name
Expand Down Expand Up @@ -114,7 +117,10 @@ def is_number(s):
outdata[mask] = np.concatenate(d_elems)
df = pd.DataFrame(outdata)
for column in df.columns:
df[column] = pd.to_numeric(df[column], errors = 'ignore')
try:
df[column] = pd.to_numeric(df[column])
except ValueError:
pass

Check warning on line 123 in resqpy/olio/read_nexus_fault.py

View check run for this annotation

Codecov / codecov/patch

resqpy/olio/read_nexus_fault.py#L122-L123

Added lines #L122 - L123 were not covered by tests
df.columns = ['i1', 'i2', 'j1', 'j2', 'k1', 'k2', 'mult']
df['grid'] = grid
df['name'] = name
Expand Down

0 comments on commit 9062ba4

Please sign in to comment.