11 template <>
struct is_error_code_enum<
jni::
error> :
public true_type {};
18 class Impl :
public std::error_category
21 const char* name()
const noexcept override
26 std::string message(
int ev)
const override
28 switch (
static_cast<error>(ev))
31 case jni_err:
return "Unspecified error";
35 return "Unknown error";
45 if (err != JNI_OK)
throw std::system_error(err,
ErrorCategory());
81 return env.FindClass(
"java/lang/Error");
105 std::rethrow_exception(e);
110 catch (
const std::exception& e)
Definition: errors.hpp:58
Definition: advanced_ownership.hpp:6
void CheckErrorCode(jint err)
Definition: errors.hpp:43
void ThrowJavaError(JNIEnv &env, std::exception_ptr e)
Definition: errors.hpp:101
R CheckJavaException(JNIEnv &env, R &&r)
Definition: errors.hpp:61
const std::error_category & ErrorCategory()
Definition: errors.hpp:16
error
Definition: types.hpp:91
@ jni_err
Definition: types.hpp:93
@ jni_ok
Definition: types.hpp:92
@ jni_eversion
Definition: types.hpp:95
@ jni_edetached
Definition: types.hpp:94
void CheckJavaExceptionThenErrorCode(JNIEnv &env, jint err)
Definition: errors.hpp:72
inline ::jclass JavaErrorClass(JNIEnv &env)
Definition: errors.hpp:79
Definition: errors.hpp:10