-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Hi there,
I'm trying to implement a generic error handling in the native library like this:
-(void) throwJavaException:(JNIEnv *)env withMessage: (const char *)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:
@try
{
....
} @catch (NSException *e) {
[self throwJavaException: env withMessage: [[e reason] UTF8String] ];
NSLog(@"Exception: %@", e);
}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!
Metadata
Metadata
Assignees
Labels
No labels