@@ -211,6 +211,19 @@ id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, s
211
211
return {runtime, std::move (error)};
212
212
}
213
213
214
+ /* *
215
+ * Creates JS error value with current JS runtime and error details.
216
+ */
217
+ static jsi::Value convertJSErrorDetailsToJSRuntimeError (jsi::Runtime &runtime, NSDictionary *jsErrorDetails)
218
+ {
219
+ NSString *message = jsErrorDetails[@" message" ];
220
+
221
+ auto jsError = createJSRuntimeError (runtime, [message UTF8String ]);
222
+ jsError.asObject (runtime).setProperty (runtime, " cause" , convertObjCObjectToJSIValue (runtime, jsErrorDetails));
223
+
224
+ return jsError;
225
+ }
226
+
214
227
}
215
228
216
229
jsi::Value ObjCTurboModule::createPromise (jsi::Runtime &runtime, std::string methodName, PromiseInvocationBlock invoke)
@@ -279,11 +292,10 @@ id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, s
279
292
return ;
280
293
}
281
294
282
- NSDictionary *jsError = RCTJSErrorFromCodeMessageAndNSError (code, message, error);
283
- reject->call ([jsError ](jsi::Runtime &rt, jsi::Function &jsFunction) {
284
- jsFunction.call (rt, convertObjCObjectToJSIValue (rt, jsError ));
295
+ NSDictionary *jsErrorDetails = RCTJSErrorFromCodeMessageAndNSError (code, message, error);
296
+ reject->call ([jsErrorDetails ](jsi::Runtime &rt, jsi::Function &jsFunction) {
297
+ jsFunction.call (rt, convertJSErrorDetailsToJSRuntimeError (rt, jsErrorDetails ));
285
298
});
286
-
287
299
resolveWasCalled = NO ;
288
300
resolve = std::nullopt;
289
301
reject = std::nullopt;
0 commit comments