Skip to content

Commit 44b442f

Browse files
committed
Raise more helpful errors in _dereference_path
1 parent 6a546d6 commit 44b442f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/zarr/storage/_common.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@
3131

3232

3333
def _dereference_path(root: str, path: str) -> str:
34-
assert isinstance(root, str)
35-
assert isinstance(path, str)
34+
if not isinstance(root, str):
35+
msg = f"{root=} is not a string ({type(root)=})"
36+
raise TypeError(msg)
37+
if not isinstance(path, str):
38+
msg = f"{path=} is not a string ({type(path)=})"
39+
raise TypeError(msg)
3640
root = root.rstrip("/")
3741
path = f"{root}/{path}" if root else path
3842
return path.rstrip("/")

0 commit comments

Comments
 (0)