Skip to content

Commit 6b56342

Browse files
committed
keyerror -> filenotfounderror
1 parent 6507e43 commit 6b56342

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/zarr/core/group.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2926,8 +2926,8 @@ async def create_hierarchy_a(
29262926

29272927
for key, value in extant_node_query.items():
29282928
if isinstance(value, BaseException):
2929-
if isinstance(value, KeyError):
2930-
# ignore KeyErrors, because they represent nodes we can safely create
2929+
if isinstance(value, FileNotFoundError):
2930+
# ignore FileNotFoundError, because they represent nodes we can safely create
29312931
pass
29322932
else:
29332933
# Any other exception is a real error
@@ -3402,13 +3402,14 @@ async def _iter_members_deep(
34023402
async def _read_metadata_v3(store: Store, path: str) -> ArrayV3Metadata | GroupMetadata:
34033403
"""
34043404
Given a store_path, return ArrayV3Metadata or GroupMetadata defined by the metadata
3405-
document stored at store_path.path / zarr.json. If no such document is found, raise a KeyError.
3405+
document stored at store_path.path / zarr.json. If no such document is found, raise a
3406+
FileNotFoundError.
34063407
"""
34073408
zarr_json_bytes = await store.get(
34083409
_join_paths([path, ZARR_JSON]), prototype=default_buffer_prototype()
34093410
)
34103411
if zarr_json_bytes is None:
3411-
raise KeyError(path)
3412+
raise FileNotFoundError(path)
34123413
else:
34133414
zarr_json = json.loads(zarr_json_bytes.to_bytes())
34143415
return _build_metadata_v3(zarr_json)
@@ -3441,7 +3442,7 @@ async def _read_metadata_v2(store: Store, path: str) -> ArrayV2Metadata | GroupM
34413442
else:
34423443
if zgroup_bytes is None:
34433444
# neither .zarray or .zgroup were found results in KeyError
3444-
raise KeyError(path)
3445+
raise FileNotFoundError(path)
34453446
else:
34463447
zmeta = json.loads(zgroup_bytes.to_bytes())
34473448

0 commit comments

Comments
 (0)