16 lines
570 B
Swift
16 lines
570 B
Swift
public enum SynthesizerError: Error, CustomStringConvertible {
|
|
case modelNotFound(String)
|
|
case voicesNotFound(String)
|
|
case voiceNotAvailable(String)
|
|
case synthesisFailure(String, Error)
|
|
|
|
public var description: String {
|
|
switch self {
|
|
case .modelNotFound(let path): "kokoro model not found at \(path)"
|
|
case .voicesNotFound(let path): "voices.npz not found at \(path)"
|
|
case .voiceNotAvailable(let name): "voice '\(name)' not found in voices.npz"
|
|
case .synthesisFailure(let text, let error): "synthesis failed for '\(text.prefix(50))...': \(error)"
|
|
}
|
|
}
|
|
}
|