| 35 | |
| 36 | bool 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 | |
| 56 | JNIEnv* JavaEnv::getUnsafeEnv() { |
| 57 | thread_local JNIEnv* attachedEnv = nullptr; |
| 58 |
nothing calls this directly
no test coverage detected