6 #include <system_error> 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
void CheckJavaExceptionThenErrorCode(JNIEnv &env, jint err)
Definition: errors.hpp:72
inline ::jclass JavaErrorClass(JNIEnv &env)
Definition: errors.hpp:79
void CheckErrorCode(jint err)
Definition: errors.hpp:43
void ThrowJavaError(JNIEnv &env, std::exception_ptr e)
Definition: errors.hpp:101
error
Definition: types.hpp:90
Definition: advanced_ownership.hpp:5
const std::error_category & ErrorCategory()
Definition: errors.hpp:16
void CheckJavaException(JNIEnv &env)
Definition: errors.hpp:67