Skip to content

[v11] Storage Error Handling Consistency#13114

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

Merged
merged 5 commits into from
Jun 14, 2024
Merged

Conversation

paulb777
Copy link
Member

@paulb777paulb777 commented Jun 11, 2024

Fix#13071Fix#10889

Storage Error handling was a mix of Swift error and NSError generation. With this PR, all errors are created as Swift errors and thanks to CustomNSError, NSError's are generated as needed from the Swift error enum.

  • All Objective C/NSError handling should remain the same from a public API perspective
  • Some of the Swift error enums have additional fields to have enough information to support the corresponding NSError and to provide useful information to Swift error enum users. This is most commonly information about underlying server errors.
  • Additional error codes are added to provide NSError code mapping for errors that were introduced only in Swift after the Swift implementation transition.

Internal API review at go/storage-error-handling

@paulb777paulb777 marked this pull request as draft June 11, 2024 22:45
@github-actionsGitHub Actions
Copy link
Contributor

github-actionsbot commented Jun 11, 2024

Apple API Diff Report

Commit: 25292a7
Last updated: Thu Jun 13 12:34 PDT 2024
View workflow logs & download artifacts


FirebaseStorage

Enumerations

[MODIFIED] StorageError
[MODIFIED] StorageError
Swift: + public enum StorageError : Error , CustomNSError- public enum StorageError : Error+ case unauthenticated ( serverError : [ String : Any ])+ case unauthorized ( bucket : String , object : String , serverError : [ String : Any ])- case objectNotFound ( String )- case bucketMismatch ( String )- case internalError ( String )+ public var errorCode : Int { get }+ case objectNotFound ( object : String , serverError : [ String : Any ])+ case bucketMismatch ( message : String )- case bucketNotFound ( String )- case downloadSizeExceeded ( Int64 , Int64 )+ public var errorUserInfo : [ String : Any ] { get }- case unauthorized ( String , String )+ case downloadSizeExceeded ( total : Int64 , maxSize : Int64 )- case unknown ( String )- case invalidArgument ( String )+ case quotaExceeded ( bucket : String , serverError : [ String : Any ])+ case invalidArgument ( message : String )+ case internalError ( message : String )+ case unknown ( message : String , serverError : [ String : Any ])+ case pathError ( message : String )+ public static var errorDomain : String { get }+ case bucketNotFound ( bucket : String )- case quotaExceeded ( String )- case pathError ( String )+ case projectNotFound ( project : String )- case projectNotFound ( String )- case unauthenticated
StorageErrorCode
[ADDED] bucketMismatch
Swift: + case bucketMismatch = - 13051
[ADDED] internalError
Swift: + case internalError = - 13052
[ADDED] pathError
Swift: + case pathError = - 13053

@paulb777paulb777 marked this pull request as ready for review June 13, 2024 03:58
@paulb777paulb777 added this to the Firebase 11 milestone Jun 13, 2024
Co-authored-by: Nick Cooke <36927374+ncooke3@users.noreply.github.com>
@paulb777
Copy link
MemberAuthor

Going to merge it here - and will make any adjustments from the API review in later PRs

@paulb777paulb777 merged commit 337d1ef into release-11.0Jun 14, 2024
48 checks passed
@paulb777paulb777 deleted the pb-storage-errors branch June 14, 2024 22:51
pragatimodi pushed a commit that referenced this pull request Jun 17, 2024
Co-authored-by: Nick Cooke <36927374+ncooke3@users.noreply.github.com>
@paulb777paulb777 mentioned this pull request Jul 9, 2024
@firebasefirebase locked and limited conversation to collaborators Jul 15, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.
3 participants
@paulb777@ncooke3@google-oss-bot
close