1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
extern crate uni_tmp_jni as jni;
mod uni_global_ref;
pub use uni_global_ref::UniGlobalRef;
pub mod macroses;
#[doc(hidden)]
pub mod reimport {
pub mod jni {
pub use jni::*;
}
pub mod parking_lot {
pub use parking_lot::*;
}
pub mod log {
pub use log::*;
}
}
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum JniError {
#[error("jni went wrong")]
JniError(#[from] jni::errors::Error),
#[error("something interesing happend what we don't know about")]
Custom(Box<dyn std::error::Error>),
}
pub fn clear_exception(
env: &jni::JNIEnv,
e: jni::errors::Error,
) {
if let jni::errors::Error::JavaException = e {
if let Err(_) = env.exception_clear() {
log::error!("exception clear failed");
}
}
}