Made credentials verification errors more descriptive.

This commit is contained in:
Maurice Parker 2019-05-04 09:18:14 -05:00
parent bb42e46887
commit 38202ece8d
2 changed files with 13 additions and 4 deletions

View File

@ -28,8 +28,17 @@ final class FeedbinAPICaller: NSObject {
switch result {
case .success:
handler(.success(true))
case .failure:
handler(.success(false))
case .failure(let error):
switch error {
case TransportError.httpError(let status):
if status == 401 {
handler(.success(false))
} else {
handler(.failure(error))
}
default:
handler(.failure(error))
}
}
}

View File

@ -69,12 +69,12 @@ class AccountsAddFeedbinWindowController: NSWindowController, NSTextFieldDelegat
self.hostWindow?.endSheet(self.window!, returnCode: NSApplication.ModalResponse.OK)
} else {
self.errorMessageLabel.stringValue = NSLocalizedString("Unable to verify credentials.", comment: "Credentials Error")
self.errorMessageLabel.stringValue = NSLocalizedString("Invalid email/password combination.", comment: "Credentials Error")
}
case .failure:
self.errorMessageLabel.stringValue = NSLocalizedString("Unable to verify credentials due to networking error.", comment: "Credentials Error")
self.errorMessageLabel.stringValue = NSLocalizedString("Network error. Try again later.", comment: "Credentials Error")
}