The "Error Handling" chapter of the updated Swift 2 Programming Language has the following:
"Like a
switch statement, the compiler attempts to infer whether catch clauses are exhaustive. If such a determination can be made, the error is considered handled. Otherwise, the containing scope must handle the error, or the containing function must be declared with throws. To ensure that an error is handled, use a catchclause with a pattern that matches all errors."This is followed by a code sample that (only) catches cases in a specific Error enum.
However, if I try to use this behaviour in beta 1, I always get a compile error: "Errors thrown from here are not handled because the enclosing catch is not exhaustive", UNLESS I have a catch at the end that matches any error.
Does anyone know if a) exhaustiveness inference is just not working yet, or b) catch blocks are always going to need a catch-all case at the end? If it’s the latter, the documentation is a bit misleading and the error should probably be shown on the catch, rather than the try.