public int runAndHandleErrors ( String ... args ) { String [ ] argsWithoutDebugFlags = removeDebugFlags ( args ) ; boolean debug = argsWithoutDebugFlags . length != args . length ; if ( debug ) { System . setProperty ( "debug" , "true" ) ; } try { ExitStatus result = run ( argsWithoutDebugFlags ) ; // The caller will hang up if it gets a non-zero status if ( result != null && result . isHangup ( ) ) { return ( result . getCode ( ) > 0 ) ? result . getCode ( ) : 0 ; } return 0 ; } catch ( NoArgumentsException ex ) { showUsage ( ) ; return 1 ; } catch ( Exception ex ) { return handleError ( debug , ex ) ; } }
Run the appropriate and handle and errors .