Skip to content

Commit

Permalink
Update _utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Illviljan committed Sep 19, 2024
1 parent b9e6457 commit 9d4b9d2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions xarray/namedarray/_array_api/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,10 @@ def _dims_to_axis(
for dim in _dims:
try:
axis += (x.dims.index(dim),)
except ValueError:
raise ValueError(f"{dim!r} not found in array dimensions {x.dims!r}")
except ValueError as err:
raise ValueError(
f"{dim!r} not found in array dimensions {x.dims!r}"
) from err
return axis

if axis is None:
Expand Down

0 comments on commit 9d4b9d2

Please sign in to comment.