From b46d8f5e76c956b90f480a38e6f41e9a0e3691f2 Mon Sep 17 00:00:00 2001 From: baegteun Date: Fri, 26 May 2023 22:58:37 +0900 Subject: [PATCH 1/2] =?UTF-8?q?:recycle:=20::=20API=20=EB=AA=85=EC=84=B8?= =?UTF-8?q?=EC=84=9C=EC=99=80=20Error=20=EC=9D=BC=EC=B9=98=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Domain/AuthDomain/Interface/Error/AuthDomainError.swift | 4 ++-- .../Domain/AuthDomain/Sources/Endpoint/AuthEndpoint.swift | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Projects/Domain/AuthDomain/Interface/Error/AuthDomainError.swift b/Projects/Domain/AuthDomain/Interface/Error/AuthDomainError.swift index b321ee29..5b7702e2 100644 --- a/Projects/Domain/AuthDomain/Interface/Error/AuthDomainError.swift +++ b/Projects/Domain/AuthDomain/Interface/Error/AuthDomainError.swift @@ -1,14 +1,14 @@ import Foundation public enum AuthDomainError: Error { - case invalidGAuthCode + case failedToGAuthSignin case internalServerError } extension AuthDomainError: LocalizedError { public var errorDescription: String? { switch self { - case .invalidGAuthCode: + case .failedToGAuthSignin: return "GAuth 로그인에서 문제가 생겼습니다. 지속될 시 문의해주세요." case .internalServerError: diff --git a/Projects/Domain/AuthDomain/Sources/Endpoint/AuthEndpoint.swift b/Projects/Domain/AuthDomain/Sources/Endpoint/AuthEndpoint.swift index 40452251..aed65ba0 100644 --- a/Projects/Domain/AuthDomain/Sources/Endpoint/AuthEndpoint.swift +++ b/Projects/Domain/AuthDomain/Sources/Endpoint/AuthEndpoint.swift @@ -43,6 +43,9 @@ extension AuthEndpoint: SMSEndpoint { switch self { case .signin: return [ + 400: .failedToGAuthSignin, + 401: .failedToGAuthSignin, + 404: .failedToGAuthSignin, 500: .internalServerError ] } From caf8e633ac53450ae38a09f2a70b561da16d8fae Mon Sep 17 00:00:00 2001 From: baegteun Date: Fri, 26 May 2023 23:21:21 +0900 Subject: [PATCH 2/2] :sparkles: :: invalidGAuthCode -> failedToGAuthSignin --- .../Testing/DataSource/RemoteAuthDataSourceSpy.swift | 2 +- .../AuthDomain/Testing/Repository/AuthRepositorySpy.swift | 2 +- .../Domain/AuthDomain/Testing/UseCase/LoginUseCaseSpy.swift | 2 +- .../AuthDomain/Tests/Repository/AuthRepositorySpec.swift | 4 ++-- .../Domain/AuthDomain/Tests/UseCase/LoginUseCaseSpec.swift | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Projects/Domain/AuthDomain/Testing/DataSource/RemoteAuthDataSourceSpy.swift b/Projects/Domain/AuthDomain/Testing/DataSource/RemoteAuthDataSourceSpy.swift index ddc129a1..2cb31835 100644 --- a/Projects/Domain/AuthDomain/Testing/DataSource/RemoteAuthDataSourceSpy.swift +++ b/Projects/Domain/AuthDomain/Testing/DataSource/RemoteAuthDataSourceSpy.swift @@ -5,7 +5,7 @@ final class RemoteAuthDataSourceSpy: RemoteAuthDataSource { func login(code: String) async throws -> IsAlreadySignUp { loginCallCount += 1 if code.isEmpty { - throw AuthDomainError.invalidGAuthCode + throw AuthDomainError.failedToGAuthSignin } return true } diff --git a/Projects/Domain/AuthDomain/Testing/Repository/AuthRepositorySpy.swift b/Projects/Domain/AuthDomain/Testing/Repository/AuthRepositorySpy.swift index ab08db43..f703f815 100644 --- a/Projects/Domain/AuthDomain/Testing/Repository/AuthRepositorySpy.swift +++ b/Projects/Domain/AuthDomain/Testing/Repository/AuthRepositorySpy.swift @@ -5,7 +5,7 @@ final class AuthRepositorySpy: AuthRepository { func login(code: String) async throws -> IsAlreadySignUp { loginCallCount += 1 if code.isEmpty { - throw AuthDomainError.invalidGAuthCode + throw AuthDomainError.failedToGAuthSignin } return true } diff --git a/Projects/Domain/AuthDomain/Testing/UseCase/LoginUseCaseSpy.swift b/Projects/Domain/AuthDomain/Testing/UseCase/LoginUseCaseSpy.swift index ae5ea429..c8ff0913 100644 --- a/Projects/Domain/AuthDomain/Testing/UseCase/LoginUseCaseSpy.swift +++ b/Projects/Domain/AuthDomain/Testing/UseCase/LoginUseCaseSpy.swift @@ -5,7 +5,7 @@ final class LoginUseCaseSpy: LoginUseCase { func execute(code: String) async throws -> IsAlreadySignUp { callCount += 1 if code.isEmpty { - throw AuthDomainError.invalidGAuthCode + throw AuthDomainError.failedToGAuthSignin } return true } diff --git a/Projects/Domain/AuthDomain/Tests/Repository/AuthRepositorySpec.swift b/Projects/Domain/AuthDomain/Tests/Repository/AuthRepositorySpec.swift index fa99925f..6e345164 100644 --- a/Projects/Domain/AuthDomain/Tests/Repository/AuthRepositorySpec.swift +++ b/Projects/Domain/AuthDomain/Tests/Repository/AuthRepositorySpec.swift @@ -17,9 +17,9 @@ final class AuthRepositorySpec: QuickSpec { describe("AuthRepositoryImpl에서") { context("code를 비운상태로 login을 실행하면") { - it("AuthDomainError.invalidGAuthCode error가 throw되고, loginCallCount가 +1 된다.") { + it("AuthDomainError.failedToGAuthSignin error가 throw되고, loginCallCount가 +1 된다.") { await expect { try await authRepositoryImpl.login(code: "") } - .to(throwError(AuthDomainError.invalidGAuthCode)) + .to(throwError(AuthDomainError.failedToGAuthSignin)) expect { remoteAuthDataSourceSpy.loginCallCount } .to(equal(1)) diff --git a/Projects/Domain/AuthDomain/Tests/UseCase/LoginUseCaseSpec.swift b/Projects/Domain/AuthDomain/Tests/UseCase/LoginUseCaseSpec.swift index e8252598..169fffc8 100644 --- a/Projects/Domain/AuthDomain/Tests/UseCase/LoginUseCaseSpec.swift +++ b/Projects/Domain/AuthDomain/Tests/UseCase/LoginUseCaseSpec.swift @@ -17,9 +17,9 @@ final class LoginUseCaseSpec: QuickSpec { describe("LoginUseCase에서") { context("code를 비운상태로 execute을 실행하면") { - it("AuthDomainError.invalidGAuthCode error가 throw되고, callCount가 +1 된다.") { + it("AuthDomainError.failedToGAuthSignin error가 throw되고, callCount가 +1 된다.") { await expect { try await loginUseCase.execute(code: "") } - .to(throwError(AuthDomainError.invalidGAuthCode)) + .to(throwError(AuthDomainError.failedToGAuthSignin)) expect { authRepositorySpy.loginCallCount } .to(equal(1))