From 4ad3da30e15806a73da9310cb42cc2388ca1731b Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 21 Oct 2020 14:57:54 -0500 Subject: [PATCH] Show correct error for already subscribed error. --- .../Sources/Account/ReaderAPI/ReaderAPICaller.swift | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Account/Sources/Account/ReaderAPI/ReaderAPICaller.swift b/Account/Sources/Account/ReaderAPI/ReaderAPICaller.swift index da2be8529..3d25e5b3f 100644 --- a/Account/Sources/Account/ReaderAPI/ReaderAPICaller.swift +++ b/Account/Sources/Account/ReaderAPI/ReaderAPICaller.swift @@ -333,7 +333,7 @@ final class ReaderAPICaller: NSObject { let postData = "T=\(token)&ac=subscribe&s=feed/\(feedURL.absoluteString)&a=user/-/label/\(folder.nameForDisplay)&t=\(name ?? "")".data(using: String.Encoding.utf8) - self.self.transport.send(request: request, method: HTTPMethod.post, payload: postData!, completion: { (result) in + self.transport.send(request: request, method: HTTPMethod.post, payload: postData!, completion: { (result) in switch result { case .success: @@ -356,17 +356,16 @@ final class ReaderAPICaller: NSObject { completion(.success(.created(subscription))) - case .failure: - completion(.failure(AccountError.createErrorAlreadySubscribed)) + case .failure(let error): + completion(.failure(error)) } }) - case .failure(let error): - completion(.failure(error)) + case .failure: + completion(.failure(AccountError.createErrorAlreadySubscribed)) } }) - case .failure(let error): completion(.failure(error)) }