Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #29861

Re: Exception Handling in Asynchronous Java Code

Newsgroups comp.lang.java.programmer
Date 2014-08-26 12:18 -0700
References <2e594246-2475-4b45-ae5e-2624b9a843d1@googlegroups.com> <lrb3rl$2m3$1@news.albasani.net>
Message-ID <2600676e-aa05-41fa-9540-e3a1f83ea600@googlegroups.com> (permalink)
Subject Re: Exception Handling in Asynchronous Java Code
From dario.crivelli@lightstreamer.com

Show all headers | View raw


Hi Sebastian, my colleague Valerio informed me of your suggestion.
I acknowledge that CompletableFuture offers a management of exceptions that is more powerful than the native support provided by the Java syntax.
However, it views exceptions as some sort of showstoppers, not as special conditions each of which may deserve a different treatment.
In fact, it does not allow you to selectively handling some types of exceptions while keeping others for further steps:
you can only handle all types of possible exceptions in the same step, perhaps to log an error at the end of the processing.

This seems to be by design; I don't know the story behind, but I wonder why there is a method
    CompletableFuture<T> exceptionally(Function<Throwable,? extends T> fn);
but not something like
    CompletableFuture<T> exceptionally(Function<Throwable,CompletionStage<T>> fn);
Am I missing something?

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Exception Handling in Asynchronous Java Code valerio.celletti@lightstreamer.com - 2014-07-30 06:49 -0700
  Re: Exception Handling in Asynchronous Java Code Sebastian <news@seyweiler.dyndns.org> - 2014-07-30 17:43 +0200
    Re: Exception Handling in Asynchronous Java Code dario.crivelli@lightstreamer.com - 2014-08-26 12:18 -0700
      Re: Exception Handling in Asynchronous Java Code Sebastian <news@seyweiler.dyndns.org> - 2014-08-27 10:55 +0200
        Re: Exception Handling in Asynchronous Java Code dario.crivelli@lightstreamer.com - 2014-08-27 13:36 -0700

csiph-web