If I have a custom error
enum MyError: Error {
case error1
case error2
}
I can catch all errors of that type and bind a variable:
do {
} catch let e as MyError {
} catch {
// everything else
}
or I can catch a specific error without binding a variable
do {
} catch MyError.error1 {
} catch {
// everything else, including MyError.error2
}
but how do I catch a specific error and bind a variable?