flushCache(); } catch (CommandActionExecutionException throwable) { Throwable cause = throwable.getCause(); if (isIgnorable(cause)) { throw new HystrixBadRequestException(cause.getMessage(), cause); } else { throw new CommandActionExecutionException(cause);
/** * Wraps cause exception to {@link CommandActionExecutionException}. * * @param throwable the throwable */ public static CommandActionExecutionException wrapCause(Throwable throwable) { return new CommandActionExecutionException(throwable.getCause()); }
private Throwable getCause(HystrixRuntimeException e) { if (e.getFailureType() != HystrixRuntimeException.FailureType.COMMAND_EXCEPTION) { return e; } Throwable cause = e.getCause(); // latest exception in flow should be propagated to end user if (e.getFallbackException() instanceof FallbackInvocationException) { cause = e.getFallbackException().getCause(); if (cause instanceof HystrixRuntimeException) { cause = getCause((HystrixRuntimeException) cause); } } else if (cause instanceof CommandActionExecutionException) { // this situation is possible only if a callee throws an exception which type extends Throwable directly CommandActionExecutionException commandActionExecutionException = (CommandActionExecutionException) cause; cause = commandActionExecutionException.getCause(); } return Optional.fromNullable(cause).or(e); }
/** * Retrieves cause exception and wraps to {@link CommandActionExecutionException}. * * @param throwable the throwable */ public static void propagateCause(Throwable throwable) throws CommandActionExecutionException { throw new CommandActionExecutionException(throwable.getCause()); }
/** *{@inheritDoc}. */ @Override protected Observable construct() { Observable result; try { Observable observable = toObservable(commandActions.getCommandAction().execute(executionType)); result = observable .onErrorResumeNext(new Func1<Throwable, Observable>() { @Override public Observable call(Throwable throwable) { if (isIgnorable(throwable)) { return Observable.error(new HystrixBadRequestException(throwable.getMessage(), throwable)); } return Observable.error(throwable); } }); flushCache(); } catch (CommandActionExecutionException throwable) { Throwable cause = throwable.getCause(); if (isIgnorable(cause)) { throw new HystrixBadRequestException(cause.getMessage(), cause); } throw throwable; } return result; }
flushCache(); } catch (CommandActionExecutionException throwable) { Throwable cause = throwable.getCause(); if (isIgnorable(cause)) { throw new HystrixBadRequestException(cause.getMessage(), cause); } else { throw new CommandActionExecutionException(cause);
/** * Wraps cause exception to {@link CommandActionExecutionException}. * * @param throwable the throwable */ public static CommandActionExecutionException wrapCause(Throwable throwable) { return new CommandActionExecutionException(throwable.getCause()); }
private Throwable getCause(HystrixRuntimeException e) { if (e.getFailureType() != HystrixRuntimeException.FailureType.COMMAND_EXCEPTION) { return e; } Throwable cause = e.getCause(); // latest exception in flow should be propagated to end user if (e.getFallbackException() instanceof FallbackInvocationException) { cause = e.getFallbackException().getCause(); if (cause instanceof HystrixRuntimeException) { cause = getCause((HystrixRuntimeException) cause); } } else if (cause instanceof CommandActionExecutionException) { // this situation is possible only if a callee throws an exception which type extends Throwable directly CommandActionExecutionException commandActionExecutionException = (CommandActionExecutionException) cause; cause = commandActionExecutionException.getCause(); } return Optional.fromNullable(cause).or(e); }
/** * Retrieves cause exception and wraps to {@link CommandActionExecutionException}. * * @param throwable the throwable */ public static void propagateCause(Throwable throwable) throws CommandActionExecutionException { throw new CommandActionExecutionException(throwable.getCause()); }
/** *{@inheritDoc}. */ @Override protected Observable construct() { Observable result; try { result = ((Observable) commandActions.getCommandAction().execute(executionType)) .onErrorResumeNext(new Func1<Throwable, Observable>() { @Override public Observable call(Throwable throwable) { if (isIgnorable(throwable)) { return Observable.error(new HystrixBadRequestException(throwable.getMessage(), throwable)); } return Observable.error(throwable); } }); flushCache(); } catch (CommandActionExecutionException throwable) { Throwable cause = throwable.getCause(); if (isIgnorable(cause)) { throw new HystrixBadRequestException(cause.getMessage(), cause); } throw throwable; } return result; }