Revert D15237424: [react-native][PR] Consistent reporting native module name on crash on native side

Differential Revision:
D15237424

Original commit changeset: ded8db45b2a2

fbshipit-source-id: 99d176e1ee796dbbe9957eda08992a8a76ba109b
This commit is contained in:
Zeyad Salloum
2019-05-07 02:44:46 -07:00
committed by Facebook Github Bot
parent d6c33f915d
commit fdd8fadea8

View File

@@ -664,11 +664,11 @@ jsi::Object JSCRuntime::createObject(std::shared_ptr<jsi::HostObject> ho) {
static JSValueRef getProperty(
JSContextRef ctx,
JSObjectRef object,
JSStringRef propName,
JSStringRef propertyName,
JSValueRef* exception) {
auto proxy = static_cast<HostObjectProxy*>(JSObjectGetPrivate(object));
auto& rt = proxy->runtime;
jsi::PropNameID sym = rt.createPropNameID(propName);
jsi::PropNameID sym = rt.createPropNameID(propertyName);
jsi::Value ret;
try {
ret = proxy->hostObject->get(rt, sym);
@@ -681,20 +681,14 @@ jsi::Object JSCRuntime::createObject(std::shared_ptr<jsi::HostObject> ho) {
.getPropertyAsFunction(rt, "Error")
.call(
rt,
std::string("Exception in HostObject::get(propName:")
+ JSStringToSTLString(propName)
+ std::string("): ") + ex.what());
std::string("Exception in HostObject::get: ") + ex.what());
*exception = rt.valueRef(excValue);
return JSValueMakeUndefined(ctx);
} catch (...) {
auto excValue =
rt.global()
.getPropertyAsFunction(rt, "Error")
.call(
rt,
std::string("Exception in HostObject::get(propName:")
+ JSStringToSTLString(propName)
+ std::string("): <unknown>"));
.call(rt, std::string("Exception in HostObject::get: ") + JSStringToSTLString(propertyName));
*exception = rt.valueRef(excValue);
return JSValueMakeUndefined(ctx);
}
@@ -724,20 +718,14 @@ jsi::Object JSCRuntime::createObject(std::shared_ptr<jsi::HostObject> ho) {
.getPropertyAsFunction(rt, "Error")
.call(
rt,
std::string("Exception in HostObject::set(propName:")
+ JSStringToSTLString(propName)
+ std::string("): ") + ex.what());
std::string("Exception in HostObject::set: ") + ex.what());
*exception = rt.valueRef(excValue);
return false;
} catch (...) {
auto excValue =
rt.global()
.getPropertyAsFunction(rt, "Error")
.call(
rt,
std::string("Exception in HostObject::set(propName:")
+ JSStringToSTLString(propName)
+ std::string("): <unknown>"));
.call(rt, "Exception in HostObject::set: <unknown>");
*exception = rt.valueRef(excValue);
return false;
}