@@ -98,10 +98,10 @@ public final class JSPromise: JSBridgedClass {
9898 @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
9999 @discardableResult
100100 public func then(
101- success: sending @escaping ( sending JSValue) async throws -> JSValue
101+ success: sending @escaping ( sending JSValue) async throws ( JSException ) -> JSValue
102102 ) -> JSPromise {
103- let closure = JSOneshotClosure . async {
104- try await success ( $0 [ 0 ] ) . jsValue
103+ let closure = JSOneshotClosure . async { arguments throws ( JSException ) -> JSValue in
104+ return try await success ( arguments [ 0 ] )
105105 }
106106 return JSPromise ( unsafelyWrapping: jsObject. then!( closure) . object!)
107107 }
@@ -127,14 +127,14 @@ public final class JSPromise: JSBridgedClass {
127127 @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
128128 @discardableResult
129129 public func then(
130- success: sending @escaping ( sending JSValue) async throws -> JSValue ,
131- failure: sending @escaping ( sending JSValue) async throws -> JSValue
130+ success: sending @escaping ( sending JSValue) async throws ( JSException ) -> JSValue ,
131+ failure: sending @escaping ( sending JSValue) async throws ( JSException ) -> JSValue
132132 ) -> JSPromise {
133- let successClosure = JSOneshotClosure . async {
134- try await success ( $0 [ 0 ] ) . jsValue
133+ let successClosure = JSOneshotClosure . async { arguments throws ( JSException ) -> JSValue in
134+ try await success ( arguments [ 0 ] ) . jsValue
135135 }
136- let failureClosure = JSOneshotClosure . async {
137- try await failure ( $0 [ 0 ] ) . jsValue
136+ let failureClosure = JSOneshotClosure . async { arguments throws ( JSException ) -> JSValue in
137+ try await failure ( arguments [ 0 ] ) . jsValue
138138 }
139139 return JSPromise ( unsafelyWrapping: jsObject. then!( successClosure, failureClosure) . object!)
140140 }
@@ -158,10 +158,10 @@ public final class JSPromise: JSBridgedClass {
158158 @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
159159 @discardableResult
160160 public func `catch`(
161- failure: sending @escaping ( sending JSValue) async throws -> JSValue
161+ failure: sending @escaping ( sending JSValue) async throws ( JSException ) -> JSValue
162162 ) -> JSPromise {
163- let closure = JSOneshotClosure . async {
164- try await failure ( $0 [ 0 ] ) . jsValue
163+ let closure = JSOneshotClosure . async { arguments throws ( JSException ) -> JSValue in
164+ try await failure ( arguments [ 0 ] ) . jsValue
165165 }
166166 return . init( unsafelyWrapping: jsObject. catch!( closure) . object!)
167167 }
0 commit comments