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:
committed by
Facebook Github Bot
parent
67915b5905
commit
073f49d0d0
@@ -15,6 +15,7 @@
|
|||||||
#include <yoga/log.h>
|
#include <yoga/log.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include "YogaJniException.h"
|
||||||
|
|
||||||
using namespace facebook::yoga::vanillajni;
|
using namespace facebook::yoga::vanillajni;
|
||||||
using facebook::yoga::detail::Log;
|
using facebook::yoga::detail::Log;
|
||||||
@@ -372,8 +373,11 @@ static void jni_YGNodeCalculateLayoutJNI(
|
|||||||
YGNodeStyleGetDirection(_jlong2YGNodeRef(nativePointer)),
|
YGNodeStyleGetDirection(_jlong2YGNodeRef(nativePointer)),
|
||||||
layoutContext);
|
layoutContext);
|
||||||
YGTransferLayoutOutputsRecursive(env, obj, root, layoutContext);
|
YGTransferLayoutOutputsRecursive(env, obj, root, layoutContext);
|
||||||
} catch (jthrowable throwable) {
|
} catch (const YogaJniException& jniException) {
|
||||||
env->Throw(throwable);
|
ScopedLocalRef<jthrowable> throwable = jniException.getThrowable();
|
||||||
|
if (throwable.get()) {
|
||||||
|
env->Throw(throwable.get());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "corefunctions.h"
|
#include "corefunctions.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
#include "YogaJniException.h"
|
||||||
|
|
||||||
namespace facebook {
|
namespace facebook {
|
||||||
namespace yoga {
|
namespace yoga {
|
||||||
@@ -72,7 +73,7 @@ void assertNoPendingJniException(JNIEnv* env) {
|
|||||||
logErrorMessageAndDie("Unable to get pending JNI exception.");
|
logErrorMessageAndDie("Unable to get pending JNI exception.");
|
||||||
}
|
}
|
||||||
env->ExceptionClear();
|
env->ExceptionClear();
|
||||||
throw throwable;
|
throw YogaJniException(throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace vanillajni
|
} // namespace vanillajni
|
||||||
|
Reference in New Issue
Block a user