Use YogaJniException in jni call exception handling

Summary:
##Changelog:
[Internal][Yoga] Use YogaJniException in jni call exception handling

Reviewed By: astreet

Differential Revision: D18745615

fbshipit-source-id: 5fcf4c31f04fade94ef98a5349782ed3d43805b0
This commit is contained in:
Sidharth Guglani
2019-12-02 05:21:56 -08:00
committed by Facebook Github Bot
parent 67915b5905
commit 073f49d0d0
2 changed files with 8 additions and 3 deletions

View File

@@ -15,6 +15,7 @@
#include <yoga/log.h>
#include <iostream>
#include <memory>
#include "YogaJniException.h"
using namespace facebook::yoga::vanillajni;
using facebook::yoga::detail::Log;
@@ -372,8 +373,11 @@ static void jni_YGNodeCalculateLayoutJNI(
YGNodeStyleGetDirection(_jlong2YGNodeRef(nativePointer)),
layoutContext);
YGTransferLayoutOutputsRecursive(env, obj, root, layoutContext);
} catch (jthrowable throwable) {
env->Throw(throwable);
} catch (const YogaJniException& jniException) {
ScopedLocalRef<jthrowable> throwable = jniException.getThrowable();
if (throwable.get()) {
env->Throw(throwable.get());
}
}
}

View File

@@ -7,6 +7,7 @@
#include "corefunctions.h"
#include "macros.h"
#include "YogaJniException.h"
namespace facebook {
namespace yoga {
@@ -72,7 +73,7 @@ void assertNoPendingJniException(JNIEnv* env) {
logErrorMessageAndDie("Unable to get pending JNI exception.");
}
env->ExceptionClear();
throw throwable;
throw YogaJniException(throwable);
}
} // namespace vanillajni