Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #30246
| X-Received | by 10.182.104.69 with SMTP id gc5mr10513911obb.18.1414631093154; Wed, 29 Oct 2014 18:04:53 -0700 (PDT) |
|---|---|
| X-Received | by 10.50.176.228 with SMTP id cl4mr246120igc.1.1414631092893; Wed, 29 Oct 2014 18:04:52 -0700 (PDT) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!h15no1872910igd.0!news-out.google.com!ks2ni6272igb.0!nntp.google.com!r10no1626552igi.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.java.programmer |
| Date | Wed, 29 Oct 2014 18:04:52 -0700 (PDT) |
| In-Reply-To | <m2r85a$t4j$1@dont-email.me> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=137.254.4.7; posting-account=yY21dwoAAAAwR_FNQzoIu2mx_B6Ohn1d |
| NNTP-Posting-Host | 137.254.4.7 |
| References | <c79cbd2e-970b-4cd3-b181-da33bb43c4b6@googlegroups.com> <1d6fc97wumvl6$.316nwmuziazw.dlg@40tude.net> <6e29c258-9842-4c60-9d99-9929a92d7a96@googlegroups.com> <m2k5p7$tic$1@dont-email.me> <6429a7c1-3430-4897-aa9b-a9836d9d8a40@googlegroups.com> <5sednVQ7leDCSdDJnZ2dnUVZ8lWdnZ2d@giganews.com> <m2lter$k8o$1@speranza.aioe.org> <xqGdnUCzDu1AGdPJnZ2dnUVZ8judnZ2d@giganews.com> <cb80pmFmpkrU1@mid.individual.net> <6fa2df26-9917-49b8-8366-087afdcc06f8@googlegroups.com> <cbbjkiFjvvcU1@mid.individual.net> <m2qics$d01$1@dont-email.me> <m2r654$j6g$1@speranza.aioe.org> <m2r85a$t4j$1@dont-email.me> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <84a3aa6f-ad37-41e2-b648-e69e884cc67a@googlegroups.com> (permalink) |
| Subject | Re: redesign exception |
| From | boxzou@gmail.com |
| Injection-Date | Thu, 30 Oct 2014 01:04:52 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Xref | csiph.com comp.lang.java.programmer:30246 |
Show key headers only | View raw
Why generate the exceptions from error codes? Just because Java's catch only catch Exception type. What if java's catch is extended to catch code? This is exactly what I am posting about. Error codes is the way to go. > > It strikes me as odd that they didn't create an SQLRuntimeException > > class (derived from RuntimeException) for the SQL errors that likely > > represent bugs in your code (syntactically malformed queries, column > > doesn't exist, > > etc.) and reserve the (checked) SQLException hierarchy for ones that can > > arise even if there is no bug in the application (or mismatch of some > > sort between the application and the database), such as I/O errors and > > constraint violations. > > > > That's the usual pattern elsewhere in Javaland, after all: > > RuntimeException (and Error) for cases that need the application code > > changing to fix, and (checked) Exception for cases that can arise > > without broken application code, but as errors that are (or, at least, > > often are) > > something else's fault (user error, network, or whatever). > > > Yes, that split into major Exception classes would be useful and would, > have been trivially easy to do by subclassing SQLRuntimeException and > SQLException. It would have been easy enough to generate the right > Exception within the JDBC driver too; the underlying SQL error codes are > given a structured set of values by every RDBMS I've used. > > > Funnily enough, almost all of the exceptions I see in actual practice > > that are not programmer errors are IOExceptions or, at least, are I/O > > exceptions. :) User misspells filename to open: IOException. Network > > resource (or network itself) goes down: IOException. I'm wondering > > actually how often it even makes sense for a checked exception not to be > > considered, at least conceptually, to be an I/O exception. > > > This is probably due to code designed to not throw Exceptions just > because input date is invalid. > > I believe a good case can be made that invalid data isn't really an > Exception because having both good and bad data input is part of normal > processing and therefore something like a boolean VALID/INVALID return > from the checking method is alll that's needed. Throwing exceptions > should be reserved for processing errors, e.g. a public holiday check on > an in-range future date discovering that the valid public holiday list > doesn't cover all permitted future dates, or finding that the input > represents a security violation serious enough to require attention from > somebody other than the user who input it. > > > -- > martin@ | Martin Gregorie > gregorie. | Essex, UK > org |
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
redesign exception boxzou@gmail.com - 2014-10-25 19:16 -0700
Re: redesign exception Joerg Meier <joergmmeier@arcor.de> - 2014-10-26 08:09 +0100
Re: redesign exception rossum <rossum48@coldmail.com> - 2014-10-26 09:15 +0000
Re: redesign exception Joerg Meier <joergmmeier@arcor.de> - 2014-10-26 10:36 +0100
Re: redesign exception Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-10-26 09:23 -0400
Re: redesign exception boxzou@gmail.com - 2014-10-26 12:56 -0700
Re: redesign exception Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-10-26 18:10 -0400
Re: redesign exception boxzou@gmail.com - 2014-10-26 17:39 -0700
Re: redesign exception boxzou@gmail.com - 2014-10-26 12:06 -0700
Re: redesign exception Joerg Meier <joergmmeier@arcor.de> - 2014-10-26 20:41 +0100
Re: redesign exception boxzou@gmail.com - 2014-10-26 12:46 -0700
Re: redesign exception boxzou@gmail.com - 2014-10-26 13:12 -0700
Re: redesign exception Leif Roar Moldskred <leifm@huldreskog.localdomain> - 2014-10-26 16:50 -0500
Re: redesign exception boxzou@gmail.com - 2014-10-26 17:21 -0700
Re: redesign exception Martin Gregorie <martin@address-in-sig.invalid> - 2014-10-27 01:05 +0000
Re: redesign exception boxzou@gmail.com - 2014-10-26 19:38 -0700
Re: redesign exception Leif Roar Moldskred <leifm@huldreskog.localdomain> - 2014-10-27 00:13 -0500
Re: redesign exception boxzou@gmail.com - 2014-10-27 04:59 -0700
Re: redesign exception Marketa Jadalova <m-jadalova3@gmail.com> - 2014-10-27 16:55 +0000
Re: redesign exception Leif Roar Moldskred <leifm@huldreskog.localdomain> - 2014-10-27 12:46 -0500
Re: redesign exception boxzou@gmail.com - 2014-10-27 15:48 -0700
Re: redesign exception Leif Roar Moldskred <leifm@huldreskog.localdomain> - 2014-10-27 22:16 -0500
Re: redesign exception Robert Klemme <shortcutter@googlemail.com> - 2014-10-27 23:54 +0100
Re: redesign exception boxzou@gmail.com - 2014-10-27 17:20 -0700
Re: redesign exception boxzou@gmail.com - 2014-10-28 07:12 -0700
Re: redesign exception Robert Klemme <shortcutter@googlemail.com> - 2014-10-29 08:34 +0100
Re: redesign exception Martin Gregorie <martin@address-in-sig.invalid> - 2014-10-29 11:17 +0000
Re: redesign exception Silvio <silvio@internet.com> - 2014-10-29 15:33 +0100
Re: redesign exception Leif Roar Moldskred <leifm@huldreskog.localdomain> - 2014-10-29 11:35 -0500
Re: redesign exception boxzou@gmail.com - 2014-10-29 17:51 -0700
Re: redesign exception Leif Roar Moldskred <leifm@huldreskog.localdomain> - 2014-10-29 20:45 -0500
Re: redesign exception boxzou@gmail.com - 2014-10-30 04:12 -0700
Re: redesign exception Silvio <silvio@internet.com> - 2014-10-30 12:38 +0100
Re: redesign exception boxzou@gmail.com - 2014-10-30 06:23 -0700
Re: redesign exception boxzou@gmail.com - 2014-10-29 17:01 -0700
Re: redesign exception Marketa Jadalova <m-jadalova3@gmail.com> - 2014-10-29 16:55 +0000
Re: redesign exception Martin Gregorie <martin@address-in-sig.invalid> - 2014-10-29 17:29 +0000
Re: redesign exception Robert Klemme <shortcutter@googlemail.com> - 2014-10-29 18:59 +0100
Re: redesign exception Martin Gregorie <martin@address-in-sig.invalid> - 2014-10-29 22:05 +0000
Re: redesign exception boxzou@gmail.com - 2014-10-29 18:04 -0700
Re: redesign exception Leif Roar Moldskred <leifm@huldreskog.localdomain> - 2014-10-29 20:56 -0500
Re: redesign exception boxzou@gmail.com - 2014-10-30 04:19 -0700
Re: redesign exception boxzou@gmail.com - 2014-10-30 04:27 -0700
Re: redesign exception boxzou@gmail.com - 2014-10-30 04:35 -0700
Re: redesign exception boxzou@gmail.com - 2014-10-29 18:01 -0700
Re: redesign exception boxzou@gmail.com - 2014-10-29 17:00 -0700
Re: redesign exception boxzou@gmail.com - 2014-10-29 16:56 -0700
Re: redesign exception boxzou@gmail.com - 2014-10-26 12:52 -0700
Re: redesign exception Silvio <silvio@internet.com> - 2014-10-27 09:03 +0100
Re: redesign exception boxzou@gmail.com - 2014-10-27 05:06 -0700
Re: redesign exception Silvio <silvio@internet.com> - 2014-10-27 13:32 +0100
Re: redesign exception boxzou@gmail.com - 2014-10-27 07:01 -0700
csiph-web