Renames ALTLocalizedError.errorFailure to failure

Better matches LocalizedError’s failureReason, recoverySuggestion, and helpAnchor naming.
This commit is contained in:
Riley Testut
2021-02-26 15:25:10 -06:00
parent 2354f85998
commit acc202031c
3 changed files with 6 additions and 6 deletions

View File

@@ -38,7 +38,7 @@ struct BackupError: ALTLocalizedError
let sourceFile: String
let sourceFileLine: Int
var errorFailure: String?
var failure: String?
var failureReason: String? {
switch self.code
@@ -60,7 +60,7 @@ struct BackupError: ALTLocalizedError
var errorUserInfo: [String : Any] {
let userInfo: [String: Any?] = [NSLocalizedDescriptionKey: self.errorDescription,
NSLocalizedFailureReasonErrorKey: self.failureReason,
NSLocalizedFailureErrorKey: self.errorFailure,
NSLocalizedFailureErrorKey: self.failure,
ErrorUserInfoKey.sourceFile: self.sourceFile,
ErrorUserInfoKey.sourceFileLine: self.sourceFileLine]
return userInfo.compactMapValues { $0 }
@@ -69,7 +69,7 @@ struct BackupError: ALTLocalizedError
init(_ code: Code, description: String? = nil, file: String = #file, line: Int = #line)
{
self.code = code
self.errorFailure = description
self.failure = description
self.sourceFile = file
self.sourceFileLine = line
}

View File

@@ -46,7 +46,7 @@ extension NSError
protocol ALTLocalizedError: LocalizedError, CustomNSError
{
var errorFailure: String? { get }
var failure: String? { get }
}
extension ALTLocalizedError
@@ -54,7 +54,7 @@ extension ALTLocalizedError
var errorUserInfo: [String : Any] {
let userInfo = [NSLocalizedDescriptionKey: self.errorDescription,
NSLocalizedFailureReasonErrorKey: self.failureReason,
NSLocalizedFailureErrorKey: self.errorFailure].compactMapValues { $0 }
NSLocalizedFailureErrorKey: self.failure].compactMapValues { $0 }
return userInfo
}
}

View File

@@ -24,7 +24,7 @@ enum VerificationError: ALTLocalizedError
}
}
var errorFailure: String? {
var failure: String? {
return String(format: NSLocalizedString("“%@” could not be installed.", comment: ""), app.name)
}