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

X-Received by 10.236.199.108 with SMTP id w72mr6080002yhn.31.1409080727446; Tue, 26 Aug 2014 12:18:47 -0700 (PDT)
X-Received by 10.140.100.182 with SMTP id s51mr38669qge.29.1409080727394; Tue, 26 Aug 2014 12:18:47 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!i13no3373886qae.1!news-out.google.com!j6ni8038qas.0!nntp.google.com!m5no3372370qaj.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.programmer
Date Tue, 26 Aug 2014 12:18:47 -0700 (PDT)
In-Reply-To <lrb3rl$2m3$1@news.albasani.net>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=82.84.148.123; posting-account=3UI3NAoAAAAjL2XRP478u99EI52dPE_y
NNTP-Posting-Host 82.84.148.123
References <2e594246-2475-4b45-ae5e-2624b9a843d1@googlegroups.com> <lrb3rl$2m3$1@news.albasani.net>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <2600676e-aa05-41fa-9540-e3a1f83ea600@googlegroups.com> (permalink)
Subject Re: Exception Handling in Asynchronous Java Code
From dario.crivelli@lightstreamer.com
Injection-Date Tue, 26 Aug 2014 19:18:47 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.java.programmer:29861

Show key headers only | 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