mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 22:50:10 +08:00
Report native module name on crash when native module has failed to load (#24633)
Summary: After upgrading RN from 0.57 to 0.59.4 we've received a lot of crash reports like `Exception in HostObject::get: <unknown>` with no clue what native module caused the crash. This commit adds native module name on crash in this situations. Related to https://github.com/facebook/react-native/issues/24607. [General] [Added] - Report native module name on crash when native module has failed to load Pull Request resolved: https://github.com/facebook/react-native/pull/24633 Differential Revision: D15120225 Pulled By: cpojer fbshipit-source-id: cf8e3e5953548a58f1d010eb70343da5ee946ae8
This commit is contained in:
committed by
Facebook Github Bot
parent
9fba85569c
commit
6ab249f220
@@ -214,11 +214,11 @@ class JSCRuntime : public jsi::Runtime {
|
||||
static JSStringRef stringRef(const jsi::String& str);
|
||||
static JSStringRef stringRef(const jsi::PropNameID& sym);
|
||||
static JSObjectRef objectRef(const jsi::Object& obj);
|
||||
|
||||
|
||||
#ifdef RN_FABRIC_ENABLED
|
||||
static JSObjectRef objectRef(const jsi::WeakObject& obj);
|
||||
#endif
|
||||
|
||||
|
||||
// Factory methods for creating String/Object
|
||||
jsi::Symbol createSymbol(JSValueRef symbolRef) const;
|
||||
jsi::String createString(JSStringRef stringRef) const;
|
||||
@@ -688,7 +688,7 @@ jsi::Object JSCRuntime::createObject(std::shared_ptr<jsi::HostObject> ho) {
|
||||
auto excValue =
|
||||
rt.global()
|
||||
.getPropertyAsFunction(rt, "Error")
|
||||
.call(rt, "Exception in HostObject::get: <unknown>");
|
||||
.call(rt, std::string("Exception in HostObject::get: ") + JSStringToSTLString(propertyName));
|
||||
*exception = rt.valueRef(excValue);
|
||||
return JSValueMakeUndefined(ctx);
|
||||
}
|
||||
@@ -1359,14 +1359,14 @@ JSStringRef JSCRuntime::stringRef(const jsi::PropNameID& sym) {
|
||||
JSObjectRef JSCRuntime::objectRef(const jsi::Object& obj) {
|
||||
return static_cast<const JSCObjectValue*>(getPointerValue(obj))->obj_;
|
||||
}
|
||||
|
||||
|
||||
#ifdef RN_FABRIC_ENABLED
|
||||
JSObjectRef JSCRuntime::objectRef(const jsi::WeakObject& obj) {
|
||||
// TODO: revisit this implementation
|
||||
return static_cast<const JSCObjectValue*>(getPointerValue(obj))->obj_;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void JSCRuntime::checkException(JSValueRef exc) {
|
||||
if (JSC_UNLIKELY(exc)) {
|
||||
throw jsi::JSError(*this, createValue(exc));
|
||||
|
||||
Reference in New Issue
Block a user