diff --git a/packages/react-native/ReactCommon/react/nativemodule/core/CMakeLists.txt b/packages/react-native/ReactCommon/react/nativemodule/core/CMakeLists.txt index 909cd427f359da..33a3d9b1ef5006 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/core/CMakeLists.txt +++ b/packages/react-native/ReactCommon/react/nativemodule/core/CMakeLists.txt @@ -32,6 +32,7 @@ target_include_directories(react_nativemodule_core target_link_libraries(react_nativemodule_core fbjni folly_runtime + glog jsi react_bridging react_debug diff --git a/packages/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboCxxModule.cpp b/packages/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboCxxModule.cpp index 71a5d3b4e0f045..fbe27c1e3c5db1 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboCxxModule.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboCxxModule.cpp @@ -10,6 +10,7 @@ #include #include +#include #include using namespace facebook; @@ -24,7 +25,7 @@ CxxModule::Callback makeTurboCxxModuleCallback( return [weakWrapper, wrapperWasCalled = false](std::vector args) mutable { if (wrapperWasCalled) { - throw std::runtime_error("callback arg cannot be called more than once"); + LOG(FATAL) << "callback arg cannot be called more than once"; } auto strongWrapper = weakWrapper.lock(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp b/packages/react-native/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp index 9f57f4d2c7f59b..616861539d1749 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -83,8 +84,7 @@ jni::local_ref createJavaCallbackFromJSIFunction( callbackWrapperOwner = std::move(callbackWrapperOwner), wrapperWasCalled = false](folly::dynamic responses) mutable { if (wrapperWasCalled) { - throw std::runtime_error( - "Callback arg cannot be called more than once"); + LOG(FATAL) << "callback arg cannot be called more than once"; } auto strongWrapper = weakWrapper.lock(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec b/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec index 43668653d04140..8824ba73561bf3 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec +++ b/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec @@ -42,6 +42,7 @@ Pod::Spec.new do |s| s.source_files = "ReactCommon/**/*.{mm,cpp,h}" + s.dependency "glog" s.dependency "ReactCommon/turbomodule/core" s.dependency "ReactCommon/turbomodule/bridging" s.dependency "React-callinvoker" diff --git a/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm b/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm index f5bcde5867565b..7c4cb68787ac81 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +++ b/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm @@ -8,6 +8,7 @@ #import "RCTTurboModule.h" #import "RCTBlockGuard.h" +#include #import #import #import @@ -184,7 +185,7 @@ id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, s BOOL __block wrapperWasCalled = NO; RCTResponseSenderBlock callback = ^(NSArray *responses) { if (wrapperWasCalled) { - throw std::runtime_error("callback arg cannot be called more than once"); + LOG(FATAL) << "callback arg cannot be called more than once"; } auto strongWrapper = weakWrapper.lock();