Skip to content

Added ArrayNotFoundError #3367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ruaridhg
Copy link

@ruaridhg ruaridhg commented Aug 11, 2025

Fixes #2961

TODO:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/user-guide/*.rst
  • Changes documented as a new file in changes/
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Aug 11, 2025
@github-actions github-actions bot removed the needs release notes Automatically applied to PRs which haven't added release notes label Aug 11, 2025
@d-v-b
Copy link
Contributor

d-v-b commented Aug 11, 2025

thank you, this looks good. we should make sure we cover all the places in the codebase where we try to read an array. maybe it's just the 1 place you found, but we should double-check.

Copy link
Contributor

@dstansby dstansby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two inline comments. In addition, did you thoroughly check that there's only a single place where an ArrayNotFoundError should be raised?

@@ -161,7 +166,7 @@ async def test_open_array(memory_store: MemoryStore, zarr_format: ZarrFormat) ->
assert z.read_only

# path not found
with pytest.raises(FileNotFoundError):
with pytest.raises(ArrayNotFoundError):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently failing the tests, because it actually raises a GroupNotFoundError now. I think the sensible thing to do here would be to create another new error, NodeNotFoundError, that is raised when a non-specific function is used (e.g., just open) to try and open either an array or a group.

@@ -34,6 +35,10 @@ class GroupNotFoundError(BaseZarrError, FileNotFoundError):
_msg = "No group found in store {!r} at path {!r}"


class ArrayNotFoundError(BaseZarrError):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also sub-class FileNotFoundError to make sure we retain backwards compatibility.

@d-v-b
Copy link
Contributor

d-v-b commented Aug 12, 2025

it might be helpful to check out #3012, which unfortunately was too bloated to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

zarr.errors ArrayNotFoundError is gone in zarr 3.0
3 participants