forked from compnerd/swift-firebase
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Cleanup error code types #62
Merged
Merged
Conversation
This file contains 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
Changes: - Allow consumers to cast `Error` instances received to `AuthErrorCode` or `FirestoreErrorCode`, corresponding to the API used. - Allow consumers to write code like `AuthErrorCode.userDisabled`. - Allow consumers to write code like `AuthErrorCode(.userDisabled)`. - Make sure `{Auth,Firestore}ErrorCode` conform to `RawRepresentable` with a `RawValue` of type `Int`. - `FirebaseError` just becomes a protocol, and `resultAndError` becomes a generic function that takes an `ErrorType.Type` parameter. This is necessary since the underlying C++ API does not have any type information for the error codes produced (they are just integers). At the Swift layer we want to generate the right concrete error types. This is all intended for better conformance to how these types are reflected to Swift from Obj C.
darinf
force-pushed
the
darin/auth-error-code
branch
from
April 6, 2024 01:13
7d55b20
to
933c4b9
Compare
compnerd
previously requested changes
Apr 8, 2024
compnerd
reviewed
Apr 8, 2024
compnerd
approved these changes
Apr 8, 2024
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.
Goals:
Error
instances received toAuthErrorCode
orFirestoreErrorCode
, corresponding to the API used.AuthErrorCode.userDisabled
.AuthErrorCode(.userDisabled)
.{Auth,Firestore}ErrorCode
conform toRawRepresentable
with aRawValue
of typeInt
.Also changes:
FirebaseError
now that it is no longer needed. This required changingresultAndError
to be generic on the error type returned. This is necessary since the underlying C++ API does not have any type information for the error codes produced (they are just integers). At the Swift layer we want to generate the right concrete error types.This is all intended for better conformance to how these types are reflected to Swift from Obj C.
Intentionally not trying to make these error types extend from
NSError
at this time. That may be interesting follow-up work.