0

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?

Mallioch
  • 1,416
  • 1
  • 10
  • 17

0 Answers0