diff --git a/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp b/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp index c09bd31766f9cf..10a9dce3cdaa86 100644 --- a/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp +++ b/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp @@ -425,17 +425,28 @@ jsi::Value UIManagerBinding::get( jsi::Value const &thisValue, jsi::Value const *arguments, size_t count) -> jsi::Value { - auto surfaceId = surfaceIdFromValue(runtime, arguments[0]); - auto shadowNodeList = - shadowNodeListFromValue(runtime, arguments[1]); - - if (sharedUIManager->backgroundExecutor_) { - sharedUIManager->backgroundExecutor_( - [sharedUIManager, surfaceId, shadowNodeList] { - sharedUIManager->completeSurface(surfaceId, shadowNodeList); - }); - } else { - uiManager->completeSurface(surfaceId, shadowNodeList); + try { + auto surfaceId = surfaceIdFromValue(runtime, arguments[0]); + auto shadowNodeList = + shadowNodeListFromValue(runtime, arguments[1]); + + if (sharedUIManager->backgroundExecutor_) { + sharedUIManager->backgroundExecutor_( + [sharedUIManager, surfaceId, shadowNodeList] { + sharedUIManager->completeSurface( + surfaceId, shadowNodeList); + }); + } else { + uiManager->completeSurface(surfaceId, shadowNodeList); + } + } catch (std::exception const &e) { + LOG(ERROR) << "Exception in UIManagerBinding::completeRoot(): " + << e.what(); + abort(); + } catch (...) { + LOG(ERROR) + << "Exception in UIManagerBinding::completeRoot(): Unknown."; + abort(); } return jsi::Value::undefined(); @@ -452,9 +463,19 @@ jsi::Value UIManagerBinding::get( jsi::Value const &thisValue, jsi::Value const *arguments, size_t count) -> jsi::Value { - uiManager->completeSurface( - surfaceIdFromValue(runtime, arguments[0]), - shadowNodeListFromValue(runtime, arguments[1])); + try { + uiManager->completeSurface( + surfaceIdFromValue(runtime, arguments[0]), + shadowNodeListFromValue(runtime, arguments[1])); + } catch (std::exception const &e) { + LOG(ERROR) << "Exception in UIManagerBinding::completeRoot(): " + << e.what(); + abort(); + } catch (...) { + LOG(ERROR) + << "Exception in UIManagerBinding::completeRoot(): Unknown."; + abort(); + } return jsi::Value::undefined(); });