MCPcopy Create free account
hub / github.com/Snapchat/Valdi / checkException

Method checkException

valdi_core/src/valdi_core/jni/JavaEnv.cpp:37–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36bool JavaEnv::checkException() {
37 auto* env = getUnsafeEnv();
38
39 if (VALDI_UNLIKELY(env->ExceptionCheck() != 0u)) {
40 auto exception = JavaException(JavaEnv(), djinni::LocalRef<jobject>(env->ExceptionOccurred()));
41 env->ExceptionClear();
42
43 auto* exceptionHandler = JavaEnv::getExceptionHandlerForCurrentThread();
44 if (exceptionHandler != nullptr) {
45 exceptionHandler->onException(std::move(exception));
46 } else {
47 exception.handleFatal(env, std::nullopt);
48 }
49
50 return false;
51 }
52
53 return true;
54}
55
56JNIEnv* JavaEnv::getUnsafeEnv() {
57 thread_local JNIEnv* attachedEnv = nullptr;
58

Callers

nothing calls this directly

Calls 4

JavaExceptionClass · 0.70
JavaEnvClass · 0.70
onExceptionMethod · 0.45
handleFatalMethod · 0.45

Tested by

no test coverage detected