realm-java icon indicating copy to clipboard operation
realm-java copied to clipboard

Clean up JNI exceptions

Open beeender opened this issue 7 years ago • 0 comments

Currently we are trying to convert all JNI exceptions to java exceptions to make it more readable for users. But the disadvantage is we could not see the native backtrace anymore which makes the native debug even more difficult.

So we should categorize the JNI exceptions a bit:

  • Exception caused by wrong java input, misuse of the API, and others which is not a Realm side issues, those thing should be converted to a java exception.
  • Exception like fatal issue, system API misbehaviour or others which is probably caused by Realm or system bugs, a native crash should just happen in case we can get more native backtrace to debug.

Also merge #3348 into this one.

  • Remove ClassNotFound. It is not something should ever happen.
  • Better converter logic, use a map for cpp class -> java class string maybe?
  • Format the exception string in a better way/a unique way.
  • Refactor the test -- it should have input as a cpp exception and output as a java exception.

beeender avatar Sep 02 '16 06:09 beeender