Stop catching exceptions in the cxx bridge

Reviewed By: mhorowitz

Differential Revision: D3186631

fbshipit-source-id: 5664897b82277159c2b74b289f9a5d416633e243
This commit is contained in:
Chris Hopman 2016-05-20 18:51:26 -07:00 committed by Facebook Github Bot 6
parent c1558bc7db
commit 2ec9e0c690

View File

@ -104,37 +104,7 @@ void ModuleRegistry::callNativeMethod(ExecutorToken token, unsigned int moduleId
}
#endif
// TODO mhorowitz: systrace
std::string what;
try {
modules_[moduleId]->invoke(token, methodId, std::move(params));
return;
} catch (const std::exception& e) {
what = e.what();
// fall through;
} catch (...) {
// fall through;
}
std::string moduleName = normalizeName(modules_[moduleId]->getName());
auto descs = modules_[moduleId]->getMethods();
std::string methodName;
if (methodId < descs.size()) {
methodName = descs[methodId].name;
} else {
methodName = folly::to<std::string>("id ", methodId, " (out of range [0..",
descs.size(), "))");
}
if (what.empty()) {
throw std::runtime_error(
folly::to<std::string>("Unknown native exception in module '", moduleName,
"' method '", methodName, "'"));
} else {
throw std::runtime_error(
folly::to<std::string>("Native exception in module '", moduleName,
"' method '", methodName, "': ", what));
}
modules_[moduleId]->invoke(token, methodId, std::move(params));
}
MethodCallResult ModuleRegistry::callSerializableNativeHook(ExecutorToken token, unsigned int moduleId, unsigned int methodId, folly::dynamic&& params) {