use of com.netflix.hystrix.exception.HystrixBadRequestException in project Hystrix by Netflix.
the class GenericObservableCommand method construct.
/**
*{@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;
}
Aggregations