Tabnine Logo
Eventual.error
Code IndexAdd Tabnine to your IDE (free)

How to use
error
method
in
com.hotels.styx.api.Eventual

Best Java code snippets using com.hotels.styx.api.Eventual.error (Showing top 5 results out of 315)

origin: HotelsDotCom/styx

  @Override
  public Eventual<LiveHttpResponse> handle(LiveHttpRequest request, HttpInterceptor.Context context) {
    return router.route(request, context)
        .map(pipeline -> pipeline.handle(request, context))
        .orElseGet(() -> Eventual.error(new NoServiceConfiguredException(request.path())));
  }
}
origin: HotelsDotCom/styx

@Test
public void createFromError() {
  Eventual<String> eventual = Eventual.error(new RuntimeException("things went wrong"));
  StepVerifier.create(eventual)
      .expectError(RuntimeException.class)
      .verify();
}
origin: HotelsDotCom/styx

  @Override
  public Eventual<LiveHttpResponse> proceed(LiveHttpRequest request) {
    requestTracker.trackRequest(request);
    if (index < interceptors.size()) {
      HttpInterceptor.Chain chain = new HttpInterceptorChain(this, index + 1);
      HttpInterceptor interceptor = interceptors.get(index);
      try {
        return interceptor.intercept(request, chain);
      } catch (Throwable e) {
        return Eventual.error(e);
      }
    }
    requestTracker.markRequestAsSent(request);
    return new Eventual<>(toPublisher(toObservable(client.handle(request, this.context))
        .compose(StandardHttpPipeline::sendErrorOnDoubleSubscription)));
  }
}
origin: HotelsDotCom/styx

  @Test
  public void mapsErrors() {
    Eventual<String> eventual = Eventual.<String>error(new RuntimeException("ouch"))
        .onError(it -> Eventual.of("mapped error: " + it.getMessage()));

    StepVerifier.create(eventual)
        .expectNext("mapped error: ouch")
        .verifyComplete();
  }
}
origin: HotelsDotCom/styx

@Override
public Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain originalChain) {
  StatusRecordingChain chain = new StatusRecordingChain(originalChain);
  try {
    return new Eventual<>(toPublisher(
        toObservable(plugin.intercept(request, chain))
            .doOnNext(response -> recordStatusCode(chain, response))
            .onErrorResumeNext(error -> error(recordAndWrapError(chain, error)))));
  } catch (Throwable e) {
    recordException(e);
    return Eventual.error(new PluginException(e, plugin.name()));
  }
}
com.hotels.styx.apiEventualerror

Javadoc

Creates a new (@link Eventual} that emits an error.

Popular methods of Eventual

  • of
    Creates a new Eventual object from given value.
  • map
    Transforms an element synchronously by applying a mapping function.
  • <init>
    Constructs a new Eventual object from an reactive streams Publisher.
  • flatMap
    Transform an element asynchronously by applying a mapping function.
  • from
    Creates a new Eventual from a CompletionStage.
  • onError
    Transforms an error by applying an error handler function.
  • fromMono

Popular in Java

  • Start an intent from android
  • onCreateOptionsMenu (Activity)
  • getApplicationContext (Context)
  • requestLocationUpdates (LocationManager)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • ImageIO (javax.imageio)
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now