在Swift 2 Beta 1中详尽捕获问题

时间:2015-06-10 14:40:11

标签: swift2

我错过了一些明显的东西,或者这是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

对我来说,这看起来有点详尽。我在这里缺少什么?

0 个答案:

没有答案