private static int handleUnexpectedJump(final JumpException ex) { if ( ex instanceof JumpException.SpecialJump ) { // ex == JumpException.SPECIAL_JUMP System.err.println("Unexpected break: " + ex); } else if ( ex instanceof JumpException.FlowControlException ) { // NOTE: assuming a single global runtime main(args) should have : if ( Ruby.isGlobalRuntimeReady() ) { final Ruby runtime = Ruby.getGlobalRuntime(); RaiseException raise = ((JumpException.FlowControlException) ex).buildException(runtime); if ( raise != null ) handleRaiseException(raise); } else { System.err.println("Unexpected jump: " + ex); } } else { System.err.println("Unexpected: " + ex); } final StackTraceElement[] trace = ex.getStackTrace(); if ( trace != null && trace.length > 0 ) { System.err.println( ThreadContext.createRawBacktraceStringFromThrowable(ex, false) ); } else { System.err.println("HINT: to get backtrace for jump exceptions run with -Xjump.backtrace=true"); } // TODO: should match MRI (>= 2.2.3) exit status - @see ruby/test_enum.rb#test_first return 2; }
private static int handleUnexpectedJump(final JumpException ex) { if ( ex instanceof JumpException.SpecialJump ) { // ex == JumpException.SPECIAL_JUMP System.err.println("Unexpected break: " + ex); } else if ( ex instanceof JumpException.FlowControlException ) { // NOTE: assuming a single global runtime main(args) should have : if ( Ruby.isGlobalRuntimeReady() ) { final Ruby runtime = Ruby.getGlobalRuntime(); RaiseException raise = ((JumpException.FlowControlException) ex).buildException(runtime); if ( raise != null ) handleRaiseException(raise); } else { System.err.println("Unexpected jump: " + ex); } } else { System.err.println("Unexpected: " + ex); } final StackTraceElement[] trace = ex.getStackTrace(); if ( trace != null && trace.length > 0 ) { System.err.println( ThreadContext.createRawBacktraceStringFromThrowable(ex, false) ); } else { System.err.println("HINT: to get backtrace for jump exceptions run with -Xjump.backtrace=true"); } // TODO: should match MRI (>= 2.2.3) exit status - @see ruby/test_enum.rb#test_first return 2; }