Throw exception in extension method
Hi,
We are not able to throw an Android exception within extension's method call; the exception seems to be caught automatically. Here's an example:
public class Crash implements FREFunction
{
@Override
public FREObject call( FREContext context, FREObject[] args )
{
// The exception does not make the app crash and will go undetected
throw new RuntimeException("This is a runtime exception!");
}
}
This is a problem because bug tracking libraries use uncaught exception handlers and if some of the ANE exceptions are caught automatically, a lot of issues are never detected by the bug tracking libraries.
If the exception is thrown outside of the extension's method call (for example, in a custom Activity or in a posted Handler), the exception is not caught and the app crashes as it should.
public class Crash implements FREFunction
{
@Override
public FREObject call( FREContext context, FREObject[] args )
{
new Handler().post( new Runnable() {
@Override
public void run() {
// This exception will make the app crash and will be caught by Android's UncaughtExceptionHandler
throw new RuntimeException( "This is a runtime exception!" );
}
} );
return null;
}
}
Are extension calls on Android wrapped in a try-catch block by AIR? Could anybody from the AIR dev team confirm this?
Thanks!
