mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Use new getCanonicalName and getMessage methods exposed by fbjni (#37879)
Summary: When a new version of `fbjni` is released, we can simplify `getName` and `getMessage` calls on throwables. ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [ANDROID] [CHANGED] - Use new `getCanonicalName` and `getMessage` methods exposed by `fbjni` Pull Request resolved: https://github.com/facebook/react-native/pull/37879 Test Plan: https://github.com/facebookincubator/fbjni/pull/78 Reviewed By: cortinico Differential Revision: D46966561 Pulled By: javache fbshipit-source-id: f30720a30146cf8fe5125336435a1512063c253d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c34aabbb90
commit
6c729acd12
@@ -7,7 +7,7 @@ ANDROIDX_AUTOFILL_VERSION=1.1.0
|
||||
ANDROIDX_TEST_VERSION=1.1.0
|
||||
ANDROIDX_TRACING_VERSION=1.1.0
|
||||
ASSERTJ_VERSION=3.21.0
|
||||
FBJNI_VERSION=0.3.0
|
||||
FBJNI_VERSION=0.4.0
|
||||
FRESCO_VERSION=2.5.0
|
||||
INFER_ANNOTATIONS_VERSION=0.18.0
|
||||
JAVAX_INJECT_VERSION=1
|
||||
|
||||
@@ -222,7 +222,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("com.facebook.fbjni:fbjni:0.3.0")
|
||||
implementation("com.facebook.fbjni:fbjni:0.4.0")
|
||||
implementation("com.facebook.soloader:soloader:0.10.4")
|
||||
implementation("com.facebook.yoga:proguard-annotations:1.19.0")
|
||||
implementation("androidx.annotation:annotation:1.3.0")
|
||||
|
||||
+3
-9
@@ -430,15 +430,9 @@ jsi::JSError convertThrowableToJSError(
|
||||
}
|
||||
|
||||
jsi::Object cause(runtime);
|
||||
auto getName = throwable->getClass()
|
||||
->getClass()
|
||||
->getMethod<jni::local_ref<jni::JString>()>("getName");
|
||||
auto getMessage =
|
||||
throwable->getClass()->getMethod<jni::local_ref<jni::JString>()>(
|
||||
"getMessage");
|
||||
auto message = getMessage(throwable)->toStdString();
|
||||
cause.setProperty(
|
||||
runtime, "name", getName(throwable->getClass())->toStdString());
|
||||
auto name = throwable->getClass()->getCanonicalName()->toStdString();
|
||||
auto message = throwable->getMessage()->toStdString();
|
||||
cause.setProperty(runtime, "name", name);
|
||||
cause.setProperty(runtime, "message", message);
|
||||
cause.setProperty(runtime, "stackElements", std::move(stackElements));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user