private void throwExceptionIfExecutionFailed(HystrixResult<T> result) throws Throwable { if (result.getException() != null) { AstrixCallStackTrace trace = new AstrixCallStackTrace(); appendStackTrace(result.getException(), trace); throw result.getException(); } }
protected T execute() throws Throwable { HystrixCommand<HystrixResult<T>> command = createHystrixCommand(); HystrixResult<T> result; try { result = command.execute(); } catch (HystrixRuntimeException e) { // TODO: Add unit test for this case e.printStackTrace(); throw new ServiceUnavailableException(e.getFailureType().toString()); } throwExceptionIfExecutionFailed(result); return result.getResult(); }