mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-06 22:37:14 +08:00
TM iOS C++: don't throw if a method is not found
Summary: Let JS decide if a missing method should be treated as an error, or whether it allows optional methods (e.g. methods that are only for android or for ios). Reviewed By: JoshuaGross Differential Revision: D14155799 fbshipit-source-id: 1e298b46a59761cf09e98147da885b1e9a9a675a
This commit is contained in:
committed by
Facebook Github Bot
parent
d53bfed9bb
commit
45288a0f63
@@ -26,7 +26,8 @@ jsi::Value TurboModule::get(jsi::Runtime& runtime, const jsi::PropNameID& propNa
|
||||
std::string propNameUtf8 = propName.utf8(runtime);
|
||||
auto p = methodMap_.find(propNameUtf8);
|
||||
if (p == methodMap_.end()) {
|
||||
throw std::runtime_error("Function '" + propNameUtf8 + "' cannot be found on module: " + name_);
|
||||
// Method was not found, let JS decide what to do.
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
MethodMetadata meta = p->second;
|
||||
return jsi::Function::createFromHostFunction(
|
||||
|
||||
Reference in New Issue
Block a user