Skip to content

Commit 2da8ce6

Browse files
committed
refactor: case문 처리
1 parent 4f8f6d4 commit 2da8ce6

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

DevLog/Infra/Common/InfraLayerError.swift

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,17 @@ enum SocialLoginError: Error {
3636

3737
extension Error {
3838
var isSocialLoginCancelled: Bool {
39+
switch self {
3940
// Apple 로그인 취소
40-
if let authorizationError = self as? ASAuthorizationError {
41-
return authorizationError.code == .canceled
42-
}
43-
41+
case let authError as ASAuthorizationError:
42+
return authError.code == .canceled
4443
// Github 로그인 취소
45-
if let webAuthenticationSessionError = self as? ASWebAuthenticationSessionError {
46-
return webAuthenticationSessionError.code == .canceledLogin
44+
case let webAuthError as ASWebAuthenticationSessionError:
45+
return webAuthError.code == .canceledLogin
46+
default:
47+
let nsError = self as NSError
48+
// Google 로그인 취소
49+
return nsError.domain == kGIDSignInErrorDomain && nsError.code == GIDSignInError.canceled.rawValue
4750
}
48-
49-
let error = self as NSError
50-
// Google 로그인 취소
51-
return error.domain == kGIDSignInErrorDomain
52-
&& error.code == GIDSignInError.canceled.rawValue
5351
}
5452
}

0 commit comments

Comments
 (0)