From 25e79f042b8bbb06e44cca76a0fae79d01365e03 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 11 Feb 2019 16:52:00 +0000 Subject: [PATCH] Use failure::Error in utils::exception instead of jni::errors::Error --- src/main/rust/utils/exception.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/rust/utils/exception.rs b/src/main/rust/utils/exception.rs index fbd21a55..46ed204b 100644 --- a/src/main/rust/utils/exception.rs +++ b/src/main/rust/utils/exception.rs @@ -12,13 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -use jni::{errors::Result as JniResult, JNIEnv}; - +use failure::Error; +use jni::JNIEnv; use std::any::Any; -use std::error::Error; use std::thread; -type ExceptionResult = thread::Result>; +type ExceptionResult = thread::Result>; // 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. @@ -78,7 +77,7 @@ pub fn any_to_string(any: &Box) -> String { s.to_string() } else if let Some(s) = any.downcast_ref::() { s.clone() - } else if let Some(error) = any.downcast_ref::>() { + } else if let Some(error) = any.downcast_ref::>() { error.description().to_string() } else { "Unknown error occurred".to_string()