Skip to content

Conversation

d-v-b
Copy link
Contributor

@d-v-b d-v-b commented Aug 25, 2025

This pr addresses #3402 by allowing all of the zarr-specific exceptions take a single argument, which will be treated as a pre-formatted message. The old behavior, in which an exception would take multiple arguments and use them to format a canned message, is still available by passing in multiple arguments. I don't know how to deprecate this visibly, but I also suspect the API of zarr.errors is not a load-bearing member for many downstream projects.

While changing the exceptions in zarr.errors, I found more exceptions defined in zarr.core.indexing. I moved those definitions to zarr.errors, because all our errors should be defined in one place, barring a strong reason otherwise. Had all the errors been defined in place, I wouldn't have needed to use a text search to discover the additional errors in zarr.core.indexing.

@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Aug 25, 2025
@d-v-b d-v-b requested a review from a team August 25, 2025 08:22
Copy link

codecov bot commented Aug 25, 2025

Codecov Report

❌ Patch coverage is 92.45283% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.92%. Comparing base (6d4b5e7) to head (fd6c3b2).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/zarr/core/indexing.py 87.50% 2 Missing ⚠️
src/zarr/storage/_common.py 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3403      +/-   ##
==========================================
+ Coverage   94.89%   94.92%   +0.03%     
==========================================
  Files          79       79              
  Lines        9501     9503       +2     
==========================================
+ Hits         9016     9021       +5     
+ Misses        485      482       -3     
Files with missing lines Coverage Δ
src/zarr/api/asynchronous.py 90.03% <100.00%> (+0.06%) ⬆️
src/zarr/core/array.py 97.44% <100.00%> (+<0.01%) ⬆️
src/zarr/core/group.py 95.06% <100.00%> (+0.02%) ⬆️
src/zarr/core/metadata/v3.py 90.15% <100.00%> (+0.10%) ⬆️
src/zarr/errors.py 100.00% <100.00%> (+12.50%) ⬆️
src/zarr/core/indexing.py 96.26% <87.50%> (-0.15%) ⬇️
src/zarr/storage/_common.py 92.47% <66.66%> (-0.43%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot removed the needs release notes Automatically applied to PRs which haven't added release notes label Aug 25, 2025
@maxrjones
Copy link
Member

This looks good, I think a test just needs updating for my suggestion of a more informative error message. I'll approve once the tests pass

@d-v-b
Copy link
Contributor Author

d-v-b commented Aug 29, 2025

@maxrjones tests are green

@d-v-b d-v-b merged commit b8dbf56 into zarr-developers:main Aug 29, 2025
31 checks passed
@d-v-b d-v-b deleted the chore/unformatted-exceptions branch August 29, 2025 19:00
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.

2 participants