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


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

Re: Quick Error Handling Question

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Quick Error Handling Question
Date 2012-03-06 00:01 +0000
Organization UK Free Software Network
Message-ID <jj3k56$qnb$3@localhost.localdomain> (permalink)
References <XnsA00CCE30F52F5jpnasty@94.75.214.39> <log-20120305022543@ram.dialup.fu-berlin.de> <4f541e87$0$294$14726298@news.sunsite.dk> <jj3ggs$qnb$2@localhost.localdomain> <znc5r.30171$yb.3370@newsfe20.iad>

Show all headers | View raw


On Mon, 05 Mar 2012 19:55:08 -0400, Arved Sandstrom wrote:

> On 12-03-05 06:59 PM, Martin Gregorie wrote:
>> On Sun, 04 Mar 2012 21:01:42 -0500, Arne Vajhøj wrote:
>> 
>>> On 3/4/2012 8:26 PM, Stefan Ram wrote:
>>>> Novice<novice@example..com>  writes:
>>>>> Should I write stacktraces from my checked and unchecked exceptions
>>>>> to my log? Or just assume that all stacktraces will be written to
>>>>> the console and the console will always be accessible to everyone
>>>>> who needs it?
>>>>
>>>>    When an exception is checked, it usually will be handled by code
>>>>    that knows how to deal with it and, insofar, »has expected« it.
>>>>    So,
>>>>    often,
>>>>    there is no need to log all details or to log anything at all.
>>>
>>> I am a bit skeptical about the idea of checked exceptions being dealt
>>> with and therefore no details being necessary.
>>>
>>> You may catch a SQLException and be able to get the data right in the
>>> database, but you may still want to know why it failed in the first
>>> place. If it happens too frequently it may require corrective action.
>>>
>> IMO the SQL Exception is the one case where a single line is almost
>> never enough. I'd say its always necessary to work your way down the
>> SQLException chain outputing the contents of all of them and, depending
>> in the program's structure and logic, it is often a good idea to add
>> the query's text as well[1].
>> 
>> Assuming, of course, that you're using traditional SQL statements
>> rather than some JPA.
>>   
> Can't speak to other JPA implementations, but with EclipseLink logging
> you get potentially a multitude of information. Query text and bind
> parameters are already available at FINE, and there's still FINER and
> FINEST.
> 
> JPA is also well provided with its own exception classes: there are ten
> or so subclasses of javax.persistence.PersistenceException. If something
> underneath at the JDBC level throws a java.sql.SQLException you'll see
> that too.
>
Good to know. I was only excepting due to lack of experience with them. 


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

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


Thread

Quick Error Handling Question Novice <novice@example..com> - 2012-03-05 01:10 +0000
  Re: Quick Error Handling Question Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-03-04 17:20 -0800
    Re: Quick Error Handling Question Arne Vajhøj <arne@vajhoej.dk> - 2012-03-04 20:29 -0500
      Re: Quick Error Handling Question Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-03-04 17:35 -0800
        Re: Quick Error Handling Question Arne Vajhøj <arne@vajhoej.dk> - 2012-03-04 20:58 -0500
          Re: Quick Error Handling Question Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-03-04 18:11 -0800
            Re: Quick Error Handling Question Arne Vajhøj <arne@vajhoej.dk> - 2012-03-04 21:42 -0500
              Re: Quick Error Handling Question Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-03-04 19:26 -0800
                Re: Quick Error Handling Question Arne Vajhøj <arne@vajhoej.dk> - 2012-03-04 22:44 -0500
                Re: Quick Error Handling Question Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-03-04 21:20 -0800
                Re: Quick Error Handling Question Arne Vajhøj <arne@vajhoej.dk> - 2012-03-09 21:26 -0500
  Re: Quick Error Handling Question Arne Vajhøj <arne@vajhoej.dk> - 2012-03-04 20:22 -0500
    Re: Quick Error Handling Question Lew <noone@lewscanon.com> - 2012-03-05 02:48 -0800
  Re: Quick Error Handling Question Arne Vajhøj <arne@vajhoej.dk> - 2012-03-04 21:01 -0500
    Re: Quick Error Handling Question Martin Gregorie <martin@address-in-sig.invalid> - 2012-03-05 22:59 +0000
      Re: Quick Error Handling Question Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-03-05 19:55 -0400
        Re: Quick Error Handling Question Martin Gregorie <martin@address-in-sig.invalid> - 2012-03-06 00:01 +0000
  Re: Quick Error Handling Question markspace <-@.> - 2012-03-04 19:13 -0800
    Re: Quick Error Handling Question Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2012-03-10 15:21 +0200
  Re: Quick Error Handling Question Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-03-04 22:34 -0800
  Re: Quick Error Handling Question Roedy Green <see_website@mindprod.com.invalid> - 2012-03-05 02:25 -0800
  Re: Quick Error Handling Question Novice <novice@example..com> - 2012-03-05 13:51 +0000

csiph-web