Issue with exhaustive catches in Swift 2 Beta 1

56 Views Asked by At

Either I'm missing something obvious or this is a compiler error in 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
}

I get the following compiler error:

Errors thrown from here are not handled because the enclosing catch is not exhaustive

It looks kinda exhaustive to me. What am I missing here?

0

There are 0 best solutions below