Repository navigation
feat(storage): expose the service error code on StorageException - #1657
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthrough
ChangesStorage error code handling
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change exposes the storage service error code through the existing exception field with a documented fallback, and no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
267c922 to
5466fab
Compare
10c4876 to
ed0630f
Compare
5466fab to
4628c76
Compare
ed0630f to
a26a9e8
Compare
4628c76 to
381f3fd
Compare
cc3d836 to
5452239
Compare
Read the storage error code from the response body's `code` into SupabaseException.errorCode, falling back to `error` for servers that predate the schema change. Closes #1650
381f3fd to
918767e
Compare
Closes #1650. SDK-1426.
Stacked on #1647, which is where
StorageExceptionbecomes aSupabaseExceptionand itsfromJsongets its defensive field reads. Review that one first; the diff here is only the last commit.Storage answers a failed request with a body like:
{ "statusCode": "404", "error": "not_found", "code": "NoSuchKey", "message": "Object not found" }codeis the documented storage error code and is what STORAGE-629 added to the server's error schema. supabase-js picked it up in supabase/supabase-js#2537 as a newcodefield onStorageApiError.The Dart shape
A second
codefield alongsideerrorCodewould give storage two overlapping identifiers and undo the point of the unified exception in this stack, socodegoes intoSupabaseException.errorCodeinstead. That field is already documented as "service specific identifier for the error", which is exactly what this is.errorstays as the fallback for servers that predate the schema change. It is not a good primary source: against a local stack, the same field isnot_foundfor a missing object andBucket not foundfor a missing bucket, so it carries a plain sentence about as often as an identifier.codedoes not have that problem.The example in
SupabaseException.errorCode's doc comment moves fromnot_foundtoNoSuchKeyto match what storage now yields.Testing
types_test.dartcovers the threefromJsonbranches (codewins overerror,erroras fallback, null when the body has neither).basic_test.dartcovers the same through a real request, so the value survives the fetch layer rather than only the factory.melos analyzeandmelos formatclean. The fullstorage_clientsuite passes against a local stack (220 tests), as doessupabase_common.Compliance matrix
storage.errors.error_codes→implemented. Symbol, drift and schema checks pass locally.Summary by CodeRabbit
Bug Fixes
Documentation
Tests