@@ -3,16 +3,6 @@ import SwiftUI
33
44let kKeyNotFound = " Key not found "
55
6- // Errors
7- let kUsersNotFoundError = " UserNotFoundError "
8- let kEmailAlreadyInUseError = " EmailAlreadyInUseError "
9- let kInvalidEmailError = " InvalidEmailError "
10- let kWeakPasswordError = " WeakPasswordError "
11- let kSignUpTooManyTimesError = " SignUpTooManyTimesError "
12- let kWrongPasswordError = " WrongPasswordError "
13- let kAccountDisabledError = " AccountDisabledError "
14- let kEmailsDoNotMatchError = " EmailsDoNotMatchError "
15- let kUnknownError = " UnknownError "
166
177public class StringUtils {
188 let bundle : Bundle
@@ -27,37 +17,37 @@ public class StringUtils {
2717 }
2818
2919 public func localizedErrorMessage( for error: Error ) -> String {
30- let authError = error as NSError
31- let errorCode = AuthErrorCode ( rawValue: authError. code)
32- switch errorCode {
33- case . emailAlreadyInUse:
34- return localizedString (
35- for: kEmailAlreadyInUseError
36- )
37- case . invalidEmail:
38- return localizedString ( for: kInvalidEmailError)
39- case . weakPassword:
40- return localizedString ( for: kWeakPasswordError)
41- case . tooManyRequests:
42- return localizedString (
43- for: kSignUpTooManyTimesError
44- )
45- case . wrongPassword:
46- return localizedString (
47- for: kWrongPasswordError
48- )
49- case . userNotFound:
50- return localizedString (
51- for: kUsersNotFoundError
52- )
53- case . userDisabled:
54- return localizedString (
55- for: kAccountDisabledError
56- )
57- default :
58- return error. localizedDescription
20+ let authError = error as NSError
21+ let errorCode = AuthErrorCode ( rawValue: authError. code)
22+ switch errorCode {
23+ case . emailAlreadyInUse:
24+ return localizedString (
25+ for: " EmailAlreadyInUseError "
26+ )
27+ case . invalidEmail:
28+ return localizedString ( for: " InvalidEmailError " )
29+ case . weakPassword:
30+ return localizedString ( for: " WeakPasswordError " )
31+ case . tooManyRequests:
32+ return localizedString (
33+ for: " SignUpTooManyTimesError "
34+ )
35+ case . wrongPassword:
36+ return localizedString (
37+ for: " WrongPasswordError "
38+ )
39+ case . userNotFound:
40+ return localizedString (
41+ for: " UserNotFoundError "
42+ )
43+ case . userDisabled:
44+ return localizedString (
45+ for: " AccountDisabledError "
46+ )
47+ default :
48+ return error. localizedDescription
49+ }
5950 }
60- }
6151
6252 /// Auth Picker title
6353 /// found in:
0 commit comments