You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to implement a generic error handling in the native library like this:
-(void) throwJavaException:(JNIEnv *)env withMessage: (constchar *)msg
{
// You can put your own exception here
jclass c = (*env)->FindClass(env, "java/lang/RuntimeException");
(*env)->ThrowNew(env, c, msg);
}
And wrapped all functions/methods/selectors in WLJavaProxy.m into this try catch:
That would be useful. Your approach looks fine. With anything JNI related, there may be some corner cases that make it more difficult, but you'll have to wait for those cases to present themselves.
Hi there,
I'm trying to implement a generic error handling in the native library like this:
And wrapped all functions/methods/selectors in
WLJavaProxy.m
into this try catch:The hope was that for any error that occurred in native code, the VM would not crash but rather show a
RuntimeException
.Is this the correct approach to do this?
It would be nice to have such a thing to prevent crashes!
The text was updated successfully, but these errors were encountered: