Avatar
Avatar
ジュニア
@swift-5.7.3 func nonThrowing(_ body: @autoclosure () throws -> Void) { try? body() } func rethrowing(_ body: () throws -> Void) rethrows { try body() } func fail() throws { throw NSError(domain: "", code: 0) } func foo() { nonThrowing(try fail()) } func bar() { rethrowing { nonThrowing(try fail()) } }
exit status: 1 with stderr:<stdin>:8:11: error: cannot find 'NSError' in scope throw NSError(domain: "", code: 0) ^~~~~~~ <stdin>:15:5: error: call can throw, but it is not marked with 'try' and the error is not handled rethrowing { ^ <stdin>:15:16: note: call is to 'rethrows' function, but argument function can throw rethrowing { ^
🙅‍♂️ 1