throw std::logic_error instead of aborting the process and convert to java exception
Summary: Changelog: [Internal][Yoga] throw std::logic_error instead of aborting the process and convert to java exception for jni layer Reviewed By: pasqualeanatriello Differential Revision: D21301235 fbshipit-source-id: 148b27920e62990a271e1d0df8c85a2cc42f4fd4
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ac7c85c0a6
commit
07c0d539bd
@@ -388,6 +388,13 @@ static void jni_YGNodeCalculateLayoutJNI(
|
||||
if (throwable.get()) {
|
||||
env->Throw(throwable.get());
|
||||
}
|
||||
} catch (const std::logic_error& ex) {
|
||||
env->ExceptionClear();
|
||||
jclass cl = env->FindClass("Ljava/lang/IllegalStateException;");
|
||||
static const jmethodID methodId = facebook::yoga::vanillajni::getMethodId(
|
||||
env, cl, "<init>", "(Ljava/lang/String;)V");
|
||||
auto throwable = env->NewObject(cl, methodId, env->NewStringUTF(ex.what()));
|
||||
env->Throw(static_cast<jthrowable>(throwable));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user