Conform LumaCoreError to LocalizedError so the embedded message reaches the UI, instead of the opaque 'LumaCore.LumaCoreError error 1' that Foundation produces by default. Now the user sees, e.g., 'Package 'objc' not found in install result' and knows what to fix.
19 lines
482 B
Swift
19 lines
482 B
Swift
import Foundation
|
|
|
|
public enum LumaCoreError: LocalizedError {
|
|
case invalidArgument(String)
|
|
case invalidOperation(String)
|
|
case protocolViolation(String)
|
|
case notSupported(String)
|
|
|
|
public var errorDescription: String? {
|
|
switch self {
|
|
case .invalidArgument(let message),
|
|
.invalidOperation(let message),
|
|
.protocolViolation(let message),
|
|
.notSupported(let message):
|
|
return message
|
|
}
|
|
}
|
|
}
|