@@ -98,10 +98,10 @@ public final class JSPromise: JSBridgedClass {
98
98
@available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
99
99
@discardableResult
100
100
public func then(
101
- success: sending @escaping ( sending JSValue) async throws -> JSValue
101
+ success: sending @escaping ( sending JSValue) async throws ( JSException ) -> JSValue
102
102
) -> 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 ] )
105
105
}
106
106
return JSPromise ( unsafelyWrapping: jsObject. then!( closure) . object!)
107
107
}
@@ -127,14 +127,14 @@ public final class JSPromise: JSBridgedClass {
127
127
@available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
128
128
@discardableResult
129
129
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
132
132
) -> 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
135
135
}
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
138
138
}
139
139
return JSPromise ( unsafelyWrapping: jsObject. then!( successClosure, failureClosure) . object!)
140
140
}
@@ -158,10 +158,10 @@ public final class JSPromise: JSBridgedClass {
158
158
@available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
159
159
@discardableResult
160
160
public func `catch`(
161
- failure: sending @escaping ( sending JSValue) async throws -> JSValue
161
+ failure: sending @escaping ( sending JSValue) async throws ( JSException ) -> JSValue
162
162
) -> 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
165
165
}
166
166
return . init( unsafelyWrapping: jsObject. catch!( closure) . object!)
167
167
}
0 commit comments