From b8a50c7614426c611143eb846839b56ec6c50c0d Mon Sep 17 00:00:00 2001 From: David Vacca Date: Wed, 15 Aug 2018 17:50:00 -0700 Subject: [PATCH] Improve error message when a component descriptor is not implemented Summary: This diff improves the error message that is displayed when a component descriptor is not implemented in C++ Reviewed By: shergin Differential Revision: D9093562 fbshipit-source-id: 930b381bc66c20af6fa160b09e7484bad4666e28 --- .../fabric/uimanager/ComponentDescriptorRegistry.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ReactCommon/fabric/uimanager/ComponentDescriptorRegistry.cpp b/ReactCommon/fabric/uimanager/ComponentDescriptorRegistry.cpp index a41c4311a6b..357f7ec71c5 100644 --- a/ReactCommon/fabric/uimanager/ComponentDescriptorRegistry.cpp +++ b/ReactCommon/fabric/uimanager/ComponentDescriptorRegistry.cpp @@ -22,7 +22,11 @@ const SharedComponentDescriptor ComponentDescriptorRegistry::operator[](const Sh } const SharedComponentDescriptor ComponentDescriptorRegistry::operator[](const ComponentName &componentName) const { - return _registryByName.at(componentName); + auto it = _registryByName.find(componentName); + if (it == _registryByName.end()) { + throw std::invalid_argument(("Unable to find componentDescriptor for " + componentName).c_str()); + } + return it->second; } } // namespace react