-
Notifications
You must be signed in to change notification settings - Fork 490
Expand file tree
/
Copy pathAuthServiceError.swift
More file actions
45 lines (40 loc) · 1.33 KB
/
AuthServiceError.swift
File metadata and controls
45 lines (40 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import FirebaseAuth
import SwiftUI
public struct AccountMergeConflictContext: LocalizedError {
public let credential: AuthCredential
public let underlyingError: Error
public let message: String
public var errorDescription: String? {
return message
}
}
public enum AuthServiceError: LocalizedError {
case invalidEmailLink(String)
case notConfiguredProvider(String)
case clientIdNotFound(String)
case notConfiguredActionCodeSettings(String)
case reauthenticationRequired(String)
case invalidCredentials(String)
case signInFailed(underlying: Error)
case accountMergeConflict(context: AccountMergeConflictContext)
public var errorDescription: String? {
switch self {
case let .invalidEmailLink(description):
return description
case let .notConfiguredProvider(description):
return description
case let .clientIdNotFound(description):
return description
case let .notConfiguredActionCodeSettings(description):
return description
case let .reauthenticationRequired(description):
return description
case let .invalidCredentials(description):
return description
case let .signInFailed(underlying: error):
return "Failed to sign in: \(error.localizedDescription)"
case let .accountMergeConflict(context):
return context.errorDescription
}
}
}