feat(android): report full native stack trace on error (#4651)

This commit is contained in:
Sung Jeon
2025-09-01 20:52:17 +09:00
committed by GitHub
parent 4b996fc514
commit 724f63930d
2 changed files with 17 additions and 0 deletions

View File

@@ -140,6 +140,22 @@ class VideoEventEmitter {
putString("errorException", exception.toString())
putString("errorCode", errorCode)
putString("errorStackTrace", stackTrace)
// https://github.com/facebook/react-native/blob/v0.80.2/packages/react-native/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp#L465
putMap("cause", Arguments.createMap().apply {
putString("name", exception.javaClass.simpleName)
exception.message?.let { putString("message", it) }
putArray("stackElements", Arguments.createArray().apply {
exception.stackTrace.forEach { element ->
pushMap(Arguments.createMap().apply {
putString("className", element.className)
putString("fileName", element.fileName)
putInt("lineNumber", element.lineNumber)
putString("methodName", element.methodName)
})
}
})
})
}
)
}

View File

@@ -298,6 +298,7 @@ export type OnVideoErrorData = Readonly<{
localizedRecoverySuggestion?: string; // ios
domain?: string; // ios
}>;
cause?: object; // React Native convertThrowableToJSError/convertNSExceptionToJSError
target?: Int32; // ios
}>;