@Test public void shouldExtractTDPException() { TDPException expected = new TDPException(UNABLE_TO_CONNECT_TO_STREAMS); final HystrixRuntimeException hre = new HystrixRuntimeException( BAD_REQUEST_EXCEPTION, TestHystrixCommand.class, "hello", new Exception("middle", expected), new Throwable("fallback") ); final TDPException tdpException = TDPExceptionUtils.processHystrixException(hre); assertNotNull(tdpException); assertEquals(UNABLE_TO_CONNECT_TO_STREAMS, tdpException.getCode()); }
static TDPException processHystrixException(HystrixRuntimeException hre) { Throwable e = hre; TDPException innerMostTDPException = null; while (e.getCause() != null) { e = e.getCause(); if (e instanceof TDPException) { innerMostTDPException = (TDPException) e; } } if (innerMostTDPException != null) { return innerMostTDPException; } else { return new TDPException(CommonErrorCodes.UNEXPECTED_SERVICE_EXCEPTION, hre); } }
TDPExceptionUtils { static TDPException processHystrixException(HystrixRuntimeException hre) { Throwable e = hre; TDPException innerMostTDPException = null; while (e.getCause() != null) { e = e.getCause(); if (e instanceof TDPException) { innerMostTDPException = (TDPException) e; } } if (innerMostTDPException != null) { return innerMostTDPException; } else { return new TDPException(CommonErrorCodes.UNEXPECTED_SERVICE_EXCEPTION, hre); } } }
TDPExceptionUtils { static TDPException processHystrixException(HystrixRuntimeException hre) { Throwable e = hre; TDPException innerMostTDPException = null; while (e.getCause() != null) { e = e.getCause(); if (e instanceof TDPException) { innerMostTDPException = (TDPException) e; } } if (innerMostTDPException != null) { return innerMostTDPException; } else { return new TDPException(CommonErrorCodes.UNEXPECTED_SERVICE_EXCEPTION, hre); } } private  TDPExceptionUtils(); }
TDPExceptionUtils { static TDPException processHystrixException(HystrixRuntimeException hre) { Throwable e = hre; TDPException innerMostTDPException = null; while (e.getCause() != null) { e = e.getCause(); if (e instanceof TDPException) { innerMostTDPException = (TDPException) e; } } if (innerMostTDPException != null) { return innerMostTDPException; } else { return new TDPException(CommonErrorCodes.UNEXPECTED_SERVICE_EXCEPTION, hre); } } private  TDPExceptionUtils();  }
TDPExceptionUtils { static TDPException processHystrixException(HystrixRuntimeException hre) { Throwable e = hre; TDPException innerMostTDPException = null; while (e.getCause() != null) { e = e.getCause(); if (e instanceof TDPException) { innerMostTDPException = (TDPException) e; } } if (innerMostTDPException != null) { return innerMostTDPException; } else { return new TDPException(CommonErrorCodes.UNEXPECTED_SERVICE_EXCEPTION, hre); } } private  TDPExceptionUtils();   }