private static Throwable error ( final Throwable exp , final Request req , final long start ) throws IOException { final String time ; final long msec = System . currentTimeMillis ( ) - start ; if ( msec < TimeUnit . SECONDS . toMillis ( 1L ) ) { time = String . format ( "%dms" , msec ) ; } else { time = String . format ( "%ds" , msec / TimeUnit . SECONDS . toMillis ( 1L ) ) ; } return new IllegalStateException ( String . format ( "[%s %s] failed in %s: %s" , new RqMethod . Base ( req ) . method ( ) , new RqHref . Base ( req ) . href ( ) , time , exp . getLocalizedMessage ( ) ) , exp ) ; }
Create an error .