native modules: Show message in redundant rejection redbox (#53152)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53152

When a redundant reject is called, show the rejection message in the redbox. This can help us pin down the error we need to elminiate in production.

Changelog: [Internal]

Reviewed By: sanjay-io

Differential Revision: D79837541

fbshipit-source-id: 879b5dc42980867051cfab6ccb575304a4a9c4c6
This commit is contained in:
Ramanpreet Nara
2025-08-08 14:39:42 -07:00
committed by Facebook GitHub Bot
parent dc879950d1
commit 7d6d0a7735
@@ -338,12 +338,18 @@ ObjCTurboModule::createPromise(jsi::Runtime &runtime, const std::string &methodN
}
if (alreadyResolved) {
RCTLogError(@"%s: Tried to reject a promise after it's already been resolved.", moduleMethod.c_str());
RCTLogError(
@"%s: Tried to reject a promise after it's already been resolved. Message: %s",
moduleMethod.c_str(),
message.UTF8String);
return;
}
if (alreadyRejected) {
RCTLogError(@"%s: Tried to reject a promise more than once.", moduleMethod.c_str());
RCTLogError(
@"%s: Tried to reject a promise more than once. Message: %s",
moduleMethod.c_str(),
message.UTF8String);
return;
}