All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ratpack.rx2.internal.ErrorHandler Maven / Gradle / Ivy

The newest version!
package ratpack.rx2.internal;

import io.reactivex.exceptions.OnErrorNotImplementedException;
import io.reactivex.exceptions.UndeliverableException;
import io.reactivex.functions.Consumer;
import ratpack.exec.Promise;
import ratpack.func.Action;

public class ErrorHandler implements Consumer {
  @Override
  public void accept(Throwable e) throws Exception {
    if (e instanceof OnErrorNotImplementedException) {
      Promise.error(e.getCause()).then(Action.noop());
    } else if (e instanceof UndeliverableException) {
      Promise.error(e.getCause()).then(Action.noop());
    } else {
      Promise.error(e).then(Action.noop());
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy