mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-06 17:34:07 +08:00
Consistent reporting native module name on crash on native side (#24704)
Summary: PR https://github.com/facebook/react-native/pull/24633 introduced some inconsistency in crash messaging, this PR fix it. Asked by mhorowitz [General] [Added] - Consistent reporting native module name on crash on native side Pull Request resolved: https://github.com/facebook/react-native/pull/24704 Differential Revision: D15237424 Pulled By: cpojer fbshipit-source-id: ded8db45b2a2ec9998ff33fdbecef3f12c19578f
This commit is contained in:
committed by
Facebook Github Bot
parent
b3f7d53b87
commit
d6c33f915d
@@ -664,11 +664,11 @@ jsi::Object JSCRuntime::createObject(std::shared_ptr<jsi::HostObject> ho) {
|
||||
static JSValueRef getProperty(
|
||||
JSContextRef ctx,
|
||||
JSObjectRef object,
|
||||
JSStringRef propertyName,
|
||||
JSStringRef propName,
|
||||
JSValueRef* exception) {
|
||||
auto proxy = static_cast<HostObjectProxy*>(JSObjectGetPrivate(object));
|
||||
auto& rt = proxy->runtime;
|
||||
jsi::PropNameID sym = rt.createPropNameID(propertyName);
|
||||
jsi::PropNameID sym = rt.createPropNameID(propName);
|
||||
jsi::Value ret;
|
||||
try {
|
||||
ret = proxy->hostObject->get(rt, sym);
|
||||
@@ -681,14 +681,20 @@ jsi::Object JSCRuntime::createObject(std::shared_ptr<jsi::HostObject> ho) {
|
||||
.getPropertyAsFunction(rt, "Error")
|
||||
.call(
|
||||
rt,
|
||||
std::string("Exception in HostObject::get: ") + ex.what());
|
||||
std::string("Exception in HostObject::get(propName:")
|
||||
+ JSStringToSTLString(propName)
|
||||
+ std::string("): ") + 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: ") + JSStringToSTLString(propertyName));
|
||||
.call(
|
||||
rt,
|
||||
std::string("Exception in HostObject::get(propName:")
|
||||
+ JSStringToSTLString(propName)
|
||||
+ std::string("): <unknown>"));
|
||||
*exception = rt.valueRef(excValue);
|
||||
return JSValueMakeUndefined(ctx);
|
||||
}
|
||||
@@ -718,14 +724,20 @@ jsi::Object JSCRuntime::createObject(std::shared_ptr<jsi::HostObject> ho) {
|
||||
.getPropertyAsFunction(rt, "Error")
|
||||
.call(
|
||||
rt,
|
||||
std::string("Exception in HostObject::set: ") + ex.what());
|
||||
std::string("Exception in HostObject::set(propName:")
|
||||
+ JSStringToSTLString(propName)
|
||||
+ std::string("): ") + ex.what());
|
||||
*exception = rt.valueRef(excValue);
|
||||
return false;
|
||||
} catch (...) {
|
||||
auto excValue =
|
||||
rt.global()
|
||||
.getPropertyAsFunction(rt, "Error")
|
||||
.call(rt, "Exception in HostObject::set: <unknown>");
|
||||
.call(
|
||||
rt,
|
||||
std::string("Exception in HostObject::set(propName:")
|
||||
+ JSStringToSTLString(propName)
|
||||
+ std::string("): <unknown>"));
|
||||
*exception = rt.valueRef(excValue);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user