Throw error in case PGP key files cannot be read

This commit is contained in:
Danny Moesch 2019-06-29 10:28:16 +02:00 committed by Mingshen Sun
parent f0003227d5
commit b806175842
4 changed files with 13 additions and 10 deletions

View file

@ -11,6 +11,7 @@ public enum AppError: Error {
case RepositoryRemoteBranchNotFound(_: String)
case RepositoryBranchNotFound(_: String)
case KeyImport
case ReadingFile(_: String)
case PasswordDuplicated
case GitReset
case GitCommit
@ -26,7 +27,7 @@ extension AppError: LocalizedError {
public var errorDescription: String? {
let localizationKey = "\(String(describing: self).prefix(while: { $0 != "(" }))Error."
switch self {
case let .RepositoryRemoteBranchNotFound(name), let .RepositoryBranchNotFound(name):
case let .RepositoryRemoteBranchNotFound(name), let .RepositoryBranchNotFound(name), let .ReadingFile(name):
return localizationKey.localize(name)
default:
return localizationKey.localize()