Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #32438
| Path | csiph.com!news.swapon.de!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!cache.uni-koblenz.de!not-for-mail |
|---|---|
| From | Tassilo Horn <tsdh@gnu.org> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: What to do with an exception of Field.get() |
| Date | Fri, 28 Aug 2015 16:57:13 +0200 |
| Organization | University Koblenz-Landau Campus Koblenz |
| Lines | 22 |
| Message-ID | <874mjj8nqu.fsf@gnu.org> (permalink) |
| References | <87fv33fsa6.fsf@Equus.decebal.nl> <87bndrfq7c.fsf@Equus.decebal.nl> <mrps1v$494$1@dont-email.me> |
| NNTP-Posting-Host | 2.160.110.50 |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| X-Trace | cache.uni-koblenz.de 1440773833 24656 2.160.110.50 (28 Aug 2015 14:57:13 GMT) |
| X-Complaints-To | news@cache.uni-koblenz.de |
| NNTP-Posting-Date | Fri, 28 Aug 2015 14:57:13 +0000 (UTC) |
| User-Agent | Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) |
| Cancel-Lock | sha1:bfyPqiPeyb1Tqgw3VgmCvj2eD20= |
| Xref | csiph.com comp.lang.java.programmer:32438 |
Show key headers only | View raw
Eric Sosman <esosman@comcast-dot-net.invalid> writes:
>> In principle you never know where your function is used. (If you share
>> it.) So I wrote a custom exception (which gives a stacktrace). In this
>> way the user only has to check for one exception (it is used in Java
>> 6) and can decide what to do.
>
> That seems the right approach. If you haven't done so already,
> it's a good idea to propagate the original exception as the "cause"
> of the one eventually thrown:
>
> try {
> ...
> } catch (IllegalArgumentException | IllegalAccessException ex) {
> throw new WrapperException("Yikes!", ex);
> }
Catching exceptions of multiple types with one catch clause is only
supported as of Java 7, I think.
Bye,
Tassilo
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
What to do with an exception of Field.get() Cecil Westerhof <Cecil@decebal.nl> - 2015-08-28 15:37 +0200
Re: What to do with an exception of Field.get() Cecil Westerhof <Cecil@decebal.nl> - 2015-08-28 16:22 +0200
Re: What to do with an exception of Field.get() Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-08-28 10:44 -0400
Re: What to do with an exception of Field.get() Tassilo Horn <tsdh@gnu.org> - 2015-08-28 16:57 +0200
Re: What to do with an exception of Field.get() Tassilo Horn <tsdh@gnu.org> - 2015-08-28 16:52 +0200
csiph-web