Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, s
NSString *message = jsErrorDetails[@"message"];

auto jsError = createJSRuntimeError(runtime, [message UTF8String]);
jsError.asObject(runtime).setProperty(runtime, "cause", convertObjCObjectToJSIValue(runtime, jsErrorDetails));
for (NSString* key in jsErrorDetails) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiosity, what happens if we add a line like:

jsError.asObject(runtime).setProperty(runtime, [@"message" UTF8String], convertObjCObjectToJSIValue(runtime, message))

🤔 this might duplicate the message field in the own property (so it should be skipped as there is already another message field), but it should also add the message to the enumerable ones...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cipolleschi this is already happening - the for loop iterates over jsErrorDetails, including the message entry

id value = jsErrorDetails[key];
jsError.asObject(runtime).setProperty(runtime, [key UTF8String], convertObjCObjectToJSIValue(runtime, value));
}

return jsError;
}
Expand Down