Add exception utilities to the crate
This commit is contained in:
parent
37c0efad77
commit
42b2076dc1
|
@ -7,6 +7,8 @@ use jni::{
|
|||
};
|
||||
use std::ops::Deref;
|
||||
|
||||
pub(crate) mod exception;
|
||||
|
||||
pub(crate) fn java_string_to_rust(env: &JNIEnv<'_>, jstring: JString<'_>) -> String {
|
||||
env.get_string(jstring)
|
||||
.expect("Couldn't get Java string!")
|
||||
|
|
|
@ -12,16 +12,13 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use jni::JNIEnv;
|
||||
use jni::{errors::Result as JniResult, JNIEnv};
|
||||
|
||||
use std::any::Any;
|
||||
use std::error::Error;
|
||||
use std::result;
|
||||
use std::thread;
|
||||
|
||||
use JniError;
|
||||
|
||||
type ExceptionResult<T> = thread::Result<result::Result<T, JniError>>;
|
||||
type ExceptionResult<T> = thread::Result<JniResult<T>>;
|
||||
|
||||
// Returns value or "throws" exception. `error_val` is returned, because exception will be thrown
|
||||
// at the Java side. So this function should be used only for the `panic::catch_unwind` result.
|
||||
|
|
Loading…
Reference in New Issue