I have a webview application and I need to implement a custom UncaughtExceptionHandler. It works fine when Java throws an exception when the webview isn't involved. However, when a JavascriptInterface method causes an exception it goes back to javascript instead of crashing the application. I need to have it crash.
This works fine
webView.loadUrl(paramMap.getString("the url"));
displayModule.runOnUiThread(() -> webView.addJavascriptInterface(theObject, "interfaceName));
throw new RuntimeException("this goes to my UncaughtExcaptionHandler");
This breaks the javascript instead of the app
@JavascriptInterface
public void breakTheApp() {
throw new RuntimeException("this stops javascript with 'java exception was raised during method invocation'");
}