Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Martin Gregorie Newsgroups: comp.lang.java.programmer Subject: Re: redesign exception Date: Wed, 29 Oct 2014 11:17:48 +0000 (UTC) Organization: A noiseless patient Spider Lines: 27 Message-ID: References: <1d6fc97wumvl6$.316nwmuziazw.dlg@40tude.net> <6e29c258-9842-4c60-9d99-9929a92d7a96@googlegroups.com> <6429a7c1-3430-4897-aa9b-a9836d9d8a40@googlegroups.com> <5sednVQ7leDCSdDJnZ2dnUVZ8lWdnZ2d@giganews.com> <6fa2df26-9917-49b8-8366-087afdcc06f8@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 29 Oct 2014 11:17:48 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="e5160e2be48f1ea550cf61512446f525"; logging-data="13313"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/afMRP0GUiGhvBml8H1APKjTkW+UUyDV0=" User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Cancel-Lock: sha1:emaOwWVHIDVCK1s43Va9VJh1vgM= Xref: csiph.com comp.lang.java.programmer:30232 On Wed, 29 Oct 2014 08:34:41 +0100, Robert Klemme wrote: > On 28.10.2014 15:12, boxzou@gmail.com wrote: >>> - SQLConnectionException: network or other connectivity issues >> >> SQLConnectionException would not be needed if we don't have checked >> exception and we don't catch the exceptions we can't handle. > > That does not make sens: one would still want to be able to catch this > specific type of error. > He also doesn't seem to realise that you can let all the checked Exceptions you don't want to handle individually percolate up to the outer layer of a program where a catch (Exception) can deal with them by walking with Exception chains and printing the messages they contain before terminating the program. I tend to do that with all SQL related Exceptions that aren't directly related to the query, i.e. syntactic errors, miss-spelt column names etc - in short the type of error that isn't recoverable. This is easy to implement and can give good error diagnostics if carefully implemented. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |