Slide 16
Slide 16 text
Do more better
enum JSONDecodeError: ErrorType,
CustomDebugStringConvertible {
case MissingRequiredKey(String)
case UnexpectedType(key: String,
expected: Any.Type, actual: Any.Type)
var debugDescription: String {
switch self {
case .MissingRequiredKey(let key):
return "Required key '\(key)' missing"
case let .UnexpectedType(key: key,
expected: expected, actual: actual):
return "Unexpected type '\(actual)' was
supplied for '\(key): \(expected)'"
}
}
}