mirror of
https://github.com/status-im/react-native.git
synced 2025-01-26 17:30:25 +00:00
Don't mask exceptions generated from loadModule
Reviewed By: davidaurelio Differential Revision: D4112447 fbshipit-source-id: e9b3a5cefb166fe00c04b6126c9878e71f1413ec
This commit is contained in:
parent
8bb707b686
commit
4082a54649
@ -698,15 +698,12 @@ JSValueRef JSCExecutor::nativeRequire(
|
||||
}
|
||||
|
||||
double moduleId = Value(m_context, arguments[0]).asNumber();
|
||||
if (moduleId <= (double) std::numeric_limits<uint32_t>::max() && moduleId >= 0.0) {
|
||||
try {
|
||||
loadModule(moduleId);
|
||||
} catch (const std::exception&) {
|
||||
throw std::invalid_argument(folly::to<std::string>("Received invalid module ID: ", moduleId));
|
||||
}
|
||||
} else {
|
||||
throw std::invalid_argument(folly::to<std::string>("Received invalid module ID: ", moduleId));
|
||||
if (moduleId <= 0) {
|
||||
throw std::invalid_argument(folly::to<std::string>("Received invalid module ID: ",
|
||||
Value(m_context, arguments[0]).toString().str()));
|
||||
}
|
||||
|
||||
loadModule(moduleId);
|
||||
return JSValueMakeUndefined(m_context);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user