diff --git a/ReactCommon/cxxreact/CxxNativeModule.cpp b/ReactCommon/cxxreact/CxxNativeModule.cpp index f050ae1d2b3..a8e511fbec4 100644 --- a/ReactCommon/cxxreact/CxxNativeModule.cpp +++ b/ReactCommon/cxxreact/CxxNativeModule.cpp @@ -4,7 +4,7 @@ #include "Instance.h" #include - +#include #include #include "JsArgumentHelpers.h" @@ -12,7 +12,6 @@ #include "MessageQueueThread.h" using facebook::xplat::module::CxxModule; - namespace facebook { namespace react { @@ -140,9 +139,14 @@ void CxxNativeModule::invoke(unsigned int reactMethodId, folly::dynamic&& params method.func(std::move(params), first, second); } catch (const facebook::xplat::JsArgumentException& ex) { throw; + } catch (std::exception& e) { + LOG(ERROR) << "std::exception. Method call " << method.name.c_str() << " failed: " << e.what(); + std::terminate(); + } catch (std::string& error) { + LOG(ERROR) << "std::string. Method call " << method.name.c_str() << " failed: " << error.c_str(); + std::terminate(); } catch (...) { - // This means some C++ code is buggy. As above, we fail hard so the C++ - // developer can debug and fix it. + LOG(ERROR) << "Method call " << method.name.c_str() << " failed. unknown error"; std::terminate(); } });