diff --git a/packages/react-native-executorch/common/rnexecutorch/RnExecutorchInstaller.h b/packages/react-native-executorch/common/rnexecutorch/RnExecutorchInstaller.h index 0f94036f64..d130719a8d 100644 --- a/packages/react-native-executorch/common/rnexecutorch/RnExecutorchInstaller.h +++ b/packages/react-native-executorch/common/rnexecutorch/RnExecutorchInstaller.h @@ -101,11 +101,6 @@ class RnExecutorchInstaller { rt, "message", jsi::String::createFromUtf8(rt, msg)); promise->reject(jsi::Value(rt, std::move(errorData))); }); - } catch (const std::runtime_error &e) { - jsCallInvoker->invokeAsync( - [promise, msg = std::string(e.what())]() { - promise->reject(msg); - }); } catch (const std::exception &e) { jsCallInvoker->invokeAsync( [promise, msg = std::string(e.what())]() { diff --git a/packages/react-native-executorch/common/rnexecutorch/host_objects/ModelHostObject.h b/packages/react-native-executorch/common/rnexecutorch/host_objects/ModelHostObject.h index d311a3de78..7fb1387d49 100644 --- a/packages/react-native-executorch/common/rnexecutorch/host_objects/ModelHostObject.h +++ b/packages/react-native-executorch/common/rnexecutorch/host_objects/ModelHostObject.h @@ -266,14 +266,6 @@ template class ModelHostObject : public JsiHostObject { errorData.setProperty(runtime, "message", jsi::String::createFromUtf8(runtime, e.what())); throw jsi::JSError(runtime, jsi::Value(runtime, std::move(errorData))); - } catch (const std::runtime_error &e) { - // This catch should be merged with the next one - // (std::runtime_error inherits from std::exception) HOWEVER react - // native has broken RTTI which breaks proper exception type - // checking. Remove when the following change is present in our - // version: - // https://github.com/facebook/react-native/commit/3132cc88dd46f95898a756456bebeeb6c248f20e - throw jsi::JSError(runtime, e.what()); } catch (const std::exception &e) { throw jsi::JSError(runtime, e.what()); } catch (...) { @@ -344,14 +336,6 @@ template class ModelHostObject : public JsiHostObject { errorData.setProperty(runtime, "message", jsi::String::createFromUtf8(runtime, e.what())); throw jsi::JSError(runtime, jsi::Value(runtime, std::move(errorData))); - } catch (const std::runtime_error &e) { - // This catch should be merged with the next one - // (std::runtime_error inherits from std::exception) HOWEVER react - // native has broken RTTI which breaks proper exception type - // checking. Remove when the following change is present in our - // version: - // https://github.com/facebook/react-native/commit/3132cc88dd46f95898a756456bebeeb6c248f20e - throw jsi::JSError(runtime, e.what()); } catch (const std::exception &e) { throw jsi::JSError(runtime, e.what()); } catch (...) { @@ -426,22 +410,6 @@ template class ModelHostObject : public JsiHostObject { promise->reject(jsi::Value(runtime, std::move(errorData))); }); return; - } catch (const std::runtime_error &e) { - // This catch should be merged with the next two - // (std::runtime_error and jsi::JSError inherits from - // std::exception) HOWEVER react native has broken RTTI - // which breaks proper exception type checking. Remove when - // the following change is present in our version: - // https://github.com/facebook/react-native/commit/3132cc88dd46f95898a756456bebeeb6c248f20e - callInvoker->invokeAsync([e = std::move(e), promise]() { - promise->reject(std::string(e.what())); - }); - return; - } catch (const jsi::JSError &e) { - callInvoker->invokeAsync([e = std::move(e), promise]() { - promise->reject(std::string(e.what())); - }); - return; } catch (const std::exception &e) { callInvoker->invokeAsync([e = std::move(e), promise]() { promise->reject(std::string(e.what())); @@ -473,14 +441,6 @@ template class ModelHostObject : public JsiHostObject { errorData.setProperty(runtime, "message", jsi::String::createFromUtf8(runtime, e.what())); throw jsi::JSError(runtime, jsi::Value(runtime, std::move(errorData))); - } catch (const std::runtime_error &e) { - // This catch should be merged with the next one - // (std::runtime_error inherits from std::exception) HOWEVER react - // native has broken RTTI which breaks proper exception type - // checking. Remove when the following change is present in our - // version: - // https://github.com/facebook/react-native/commit/3132cc88dd46f95898a756456bebeeb6c248f20e - throw jsi::JSError(runtime, e.what()); } catch (const std::exception &e) { throw jsi::JSError(runtime, e.what()); } catch (...) {