Catch C++ exceptions in Android JNI code and rethrow them to Java.