Skip to content

Commit 6ab249f

Browse files
Dmitry Dushkinfacebook-github-bot
authored andcommitted
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 #24607. [General] [Added] - Report native module name on crash when native module has failed to load Pull Request resolved: #24633 Differential Revision: D15120225 Pulled By: cpojer fbshipit-source-id: cf8e3e5953548a58f1d010eb70343da5ee946ae8
1 parent 9fba855 commit 6ab249f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ReactCommon/jsi/JSCRuntime.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ class JSCRuntime : public jsi::Runtime {
214214
static JSStringRef stringRef(const jsi::String& str);
215215
static JSStringRef stringRef(const jsi::PropNameID& sym);
216216
static JSObjectRef objectRef(const jsi::Object& obj);
217-
217+
218218
#ifdef RN_FABRIC_ENABLED
219219
static JSObjectRef objectRef(const jsi::WeakObject& obj);
220220
#endif
221-
221+
222222
// Factory methods for creating String/Object
223223
jsi::Symbol createSymbol(JSValueRef symbolRef) const;
224224
jsi::String createString(JSStringRef stringRef) const;
@@ -688,7 +688,7 @@ jsi::Object JSCRuntime::createObject(std::shared_ptr<jsi::HostObject> ho) {
688688
auto excValue =
689689
rt.global()
690690
.getPropertyAsFunction(rt, "Error")
691-
.call(rt, "Exception in HostObject::get: <unknown>");
691+
.call(rt, std::string("Exception in HostObject::get: ") + JSStringToSTLString(propertyName));
692692
*exception = rt.valueRef(excValue);
693693
return JSValueMakeUndefined(ctx);
694694
}
@@ -1359,14 +1359,14 @@ JSStringRef JSCRuntime::stringRef(const jsi::PropNameID& sym) {
13591359
JSObjectRef JSCRuntime::objectRef(const jsi::Object& obj) {
13601360
return static_cast<const JSCObjectValue*>(getPointerValue(obj))->obj_;
13611361
}
1362-
1362+
13631363
#ifdef RN_FABRIC_ENABLED
13641364
JSObjectRef JSCRuntime::objectRef(const jsi::WeakObject& obj) {
13651365
// TODO: revisit this implementation
13661366
return static_cast<const JSCObjectValue*>(getPointerValue(obj))->obj_;
13671367
}
13681368
#endif
1369-
1369+
13701370
void JSCRuntime::checkException(JSValueRef exc) {
13711371
if (JSC_UNLIKELY(exc)) {
13721372
throw jsi::JSError(*this, createValue(exc));

0 commit comments

Comments
 (0)