-
-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: handle JNI java exceptions properly in client_core #2563
base: master
Are you sure you want to change the base?
Conversation
fn env_call_method_handled<'local>( | ||
env: &mut JNIEnv<'local>, | ||
object: &JObject, | ||
method: &str, | ||
sig: &str, | ||
args: &[JValue], | ||
) -> Result<JValueOwned<'local>, Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually i follow the path of fewer parameters when making a function to abstract away some code. In this case it would be much easier to make a function taking a jni::Result<T>
and return a anyhow::Result<T>
. Inside the function, don't panic because you don't know the intention of the caller, even if we always unwrap, don't expect anything. Instead limit this function to just transform the error.
Actually, before doing this, check if just calling .to_any()
at the caller site is enough (with the purpose of making the error message clearer). This function is defined in alvr_common. Other things you could do is to play with different printing methods (using {}
or {:?}
placeholders with format!()
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no issues with your comments and they make sense. If you get some free time, please do the needful and merge this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm quite busy, i would return to this further on maybe, not sure when. But you can work on it if you need it sooner
Converting to draft to avoid being autoclosed |
TLDR
After using the PR
before