要么我遗漏了一些明显的东西,要么这是 Xcode 7 beta 1 中的编译器错误。
class Thing {
func doAThing() {
do {
try thisCanThrow()
print("after")
}
catch CustomErrorThing.First {
print("first!")
}
catch CustomErrorThing.Second {
print("second!")
}
}
func thisCanThrow() throws {
if 6 > 4 {
throw CustomErrorThing.Second
}
}
}
enum CustomErrorThing: ErrorType {
case First
case Second
}
我收到以下编译器错误:
Errors thrown from here are not handled because the enclosing catch is not exhaustive
对我来说,它看起来有点详尽。我在这里想念什么?