Avatar
@swift-main struct MyError1: Error {} struct MyError2: Error {} func throwError() throws { throw MyError1() } do { try throwError() } catch let error { switch error { case is MyError1: print("MyError1") case is MyError2: print("MyError2") default: print("other type") } } (edited)
🙏 1