Skip to content

Commit b25f7e8

Browse files
committed
replace assertion with an informative error message
1 parent 961bd77 commit b25f7e8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/zarr/storage/local.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ def __init__(self, root: Path | str, *, mode: AccessModeLiteral = "r") -> None:
9797
super().__init__(mode=mode)
9898
if isinstance(root, str):
9999
root = Path(root)
100-
assert isinstance(root, Path)
100+
if not isinstance(root, Path):
101+
raise TypeError(
102+
f'"root" must be a string or Path instance. Got an object with type {type(root)} instead.'
103+
)
101104
self.root = root
102105

103106
async def _open(self) -> None:

0 commit comments

Comments
 (0)