exception

Aborted Exception

shutdown physical agent

e.getClass()       // class hudson.remoting.RequestAbortedException

e.cause            // java.io.IOException: Unexpected termination of the channel
e.cause.getClass() // class java.io.IOException
e.cause.dump()     // detailMessage=Unexpected termination of the channel
                   // cause=java.io.EOFException

e.message          // java.io.IOException: Unexpected termination of the channel

shutdown pod

before fully initialized

references:

after fully initialized

e.getClass()       // class hudson.remoting.RequestAbortedException

e.cause            // java.nio.channels.ClosedChannelException
e.cause.getClass() // class java.nio.channels.ClosedChannelException

e.message          // java.nio.channels.ClosedChannelException

e.suppressed.getClass()                              // class [Ljava.lang.Throwable
e.suppressed.collect { it.getClass() }.join('\n')    // class hudson.remoting.Channel$CallSiteStackTrace
e.suppressed.collect { it.message }.join('\n')       // Remote call to JNLP4-connect connection from 10.244.13.1/10.244.13.1:59576
  • sample in CI

    import hudson.remoting.RequestAbortedException
    
    try {
      ...
    } catch ( RequestAbortedException e ) {
      Throwable throwable = e.getCause()
      if ( throwable instanceof java.nio.channels.ClosedChannelException ) {
        String msg = "FAILED : ${e.message} : ${e.suppressed.collect{ it.message }. join(' && ')}"
        error ( msg )
      }
    } catch ( Exception e ) {
      def sw = new StringWriter()
      e.printStackTrace( new PrintWriter(sw) )
      echo sw.toString()
      throw e
    }
  • more samples

    import static java.lang.System.err ;
    
    try {
      ...
    } catch( Exception ex ) {
      err.println( "Exception encountered: " + ex.toString() );
      final Throwable[] suppressedExceptions = ex.getSuppressed();
      final int numSuppressed = suppressedExceptions.length;
      if ( numSuppressed ) {
        err.println( "There are ${numSuppressed} suppressed exceptions: " );
        for ( final Throwable exception : suppressedExceptions ) {
          err.println( exception.toString() );
        }
      }
    }

Last updated