mirror of
https://github.com/Lakr233/vphone-cli.git
synced 2026-04-05 04:59:05 +08:00
30 lines
978 B
Swift
30 lines
978 B
Swift
// PatcherError.swift — Error types for firmware patching.
|
|
|
|
import Foundation
|
|
|
|
public enum PatcherError: Error, CustomStringConvertible, Sendable {
|
|
case fileNotFound(String)
|
|
case invalidFormat(String)
|
|
case patchSiteNotFound(String)
|
|
case patchVerificationFailed(String)
|
|
case encodingFailed(String)
|
|
case multipleMatchesFound(String, count: Int)
|
|
|
|
public var description: String {
|
|
switch self {
|
|
case let .fileNotFound(path):
|
|
"File not found: \(path)"
|
|
case let .invalidFormat(msg):
|
|
"Invalid format: \(msg)"
|
|
case let .patchSiteNotFound(msg):
|
|
"Patch site not found: \(msg)"
|
|
case let .patchVerificationFailed(msg):
|
|
"Patch verification failed: \(msg)"
|
|
case let .encodingFailed(msg):
|
|
"Instruction encoding failed: \(msg)"
|
|
case let .multipleMatchesFound(msg, count):
|
|
"Expected 1 match for \(msg), found \(count)"
|
|
}
|
|
}
|
|
}
|