feat(storage): expose the service error code on StorageException - #1657
Open
spydon wants to merge 1 commit into
Open
feat(storage): expose the service error code on StorageException#1657spydon wants to merge 1 commit into
spydon wants to merge 1 commit into
Conversation
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
Tr00d
approved these changes
Aug 6, 2026
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
spydon
force-pushed
the
parity/storage-service-error-code
branch
from
August 6, 2026 09:16
267c922 to
5466fab
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.