diff --git a/SNUTT-2022/SNUTT/Repositories/NetworkUtils.swift b/SNUTT-2022/SNUTT/Repositories/NetworkUtils.swift index 899419ac..b833ae33 100644 --- a/SNUTT-2022/SNUTT/Repositories/NetworkUtils.swift +++ b/SNUTT-2022/SNUTT/Repositories/NetworkUtils.swift @@ -115,6 +115,7 @@ extension DataTask { if let data = await response.data, let errDto = try? JSONDecoder().decode(ErrorDto.self, from: data) { + try Task.checkCancellation() let errCode = ErrorCode(rawValue: errDto.errcode) var requestInfo = await collectRequestInfo() requestInfo["ErrorMessage"] = errCode?.errorMessage @@ -129,13 +130,13 @@ extension DataTask { throw STError(errCode ?? .SERVER_FAULT) } } - if let dto = try? await value { return dto } - + try Task.checkCancellation() let requestInfo = await collectRequestInfo() Crashlytics.crashlytics().record(error: NSError(domain: "UNKNOWN_ERROR", code: -1, userInfo: requestInfo)) + try Task.checkCancellation() throw STError(.SERVER_FAULT) } diff --git a/SNUTT-2022/SNUTT/ViewModels/FriendsViewModel.swift b/SNUTT-2022/SNUTT/ViewModels/FriendsViewModel.swift index ad634c3b..25643299 100644 --- a/SNUTT-2022/SNUTT/ViewModels/FriendsViewModel.swift +++ b/SNUTT-2022/SNUTT/ViewModels/FriendsViewModel.swift @@ -36,6 +36,7 @@ class FriendsViewModel: BaseViewModel, ObservableObject { Task { @MainActor [weak self] in guard let self else { return } appState.friend.pendingFriendRequestToken = nil + try await Task.sleep(nanoseconds: 500_000_000) await eventEmitter.emitEvent(.addFriendKakao, payload: ["requestToken": token]) } }