Avatar
Avatar
ジュニア
@swift-5.7.3 enum HogeError: Error { case hoge } func nonThrowing(_ body: @autoclosure () throws -> Void) { try? body() } func rethrowing(_ body: () throws -> Void) rethrows { try body() } func fail() throws { throw HogeError.hoge } func foo() { nonThrowing(try fail()) } func bar() { rethrowing { nonThrowing(try fail()) } }
exit status: 1 with stderr:<stdin>:17:5: error: call can throw, but it is not marked with 'try' and the error is not handled rethrowing { ^ <stdin>:17:16: note: call is to 'rethrows' function, but argument function can throw rethrowing { ^