2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
// author: Max Kellermann <max.kellermann@gmail.com>
|
2019-04-24 13:51:19 +02:00
|
|
|
|
|
|
|
#include "Exception.hxx"
|
|
|
|
#include "Object.hxx"
|
|
|
|
#include "String.hxx"
|
|
|
|
|
|
|
|
Java::Exception::Exception(JNIEnv *env, jthrowable e) noexcept
|
|
|
|
:std::runtime_error(Java::String(env, Object::toString(env, e)).ToString())
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Java::RethrowException(JNIEnv *env)
|
|
|
|
{
|
2021-03-28 13:55:38 +02:00
|
|
|
LocalRef<jthrowable> exception{env, env->ExceptionOccurred()};
|
|
|
|
if (!exception)
|
2019-04-24 13:51:19 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
env->ExceptionClear();
|
|
|
|
throw Exception(env, exception);
|
|
|
|
}
|