Skip to content

Commit 8ed5a7d

Browse files
committed
fix: error handling decode_cf_var exceptions - use add_note
1 parent 7f57f01 commit 8ed5a7d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

xarray/conventions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,8 @@ def stackable(dim: Hashable) -> bool:
422422
decode_timedelta=_item_or_default(decode_timedelta, k, None),
423423
)
424424
except Exception as e:
425-
raise type(e)(f"Failed to decode variable {k!r}: {e}") from e
425+
e.add_note(f"Raised while decoding variable {k!r} with value {v!r}")
426+
raise
426427
if decode_coords in [True, "coordinates", "all"]:
427428
var_attrs = new_vars[k].attrs
428429
if "coordinates" in var_attrs:

0 commit comments

Comments
 (0)