true - you've convinced me. I've seen the light. cheers. One area I'm wary of is convoluted multi-key exceptions where the number of CFCATACH's starts out-numbering the page code.
In almost all cases I'm hoping a simple catch="custom" (or similar) will do and just use the message for the user alert, ready for them to retry. Perhaps a couple of specific database ones (duplicate key in index, etc) as well and let the rest go thru to the keeper (CFERROR) as part of the request finishing up (which logs the error details and emails home with the details). do people use any more complex exception strategies? I realise every case is different but I'm curious where (generally) multi-keyed exceptions would really help: application.this application.that application.this.other application.this.other.another application.this.other.another.hereComesAnotherOne etc... thanx barry.b On Apr 1, 2005 5:31 PM, Roland Collins <[EMAIL PROTECTED]> wrote: > In that case, why save the result, since a failure will result in an > exception?! > > Just do: > > <cfset controller.DeleteStudent(argumentCollection ="#args#") /> > > Instead and save a variable allocation. > > Roland > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf > Of Barry Beattie > Sent: Thursday, March 31, 2005 10:03 PM > To: [email protected] > Subject: Re: [CFCDev] exceptions and passing context specific error messages > to the UI > > you mean like this? > > <cftry> > <cfset bOK = controller.DeleteStudent(argumentCollection ="#args#") /> > <cfcatch type="database"> > <!--- check to see which type of errors are thrown... > if things like duplicate key index, display restart message > else rethrow? ---> > </cfcatch> > <cfcatch type="custom"> > <!--- this is where I suspect the business logic errors are caught---> > </cfcatch> > </cftry> > <!--- any others left over are handled by CFERROR? ---> > > so the only throw/catch is done by the UI in the initial call? none of > the model/controller CFC's try/catch (except in rare cases eg: roll > back something) - they just cfthrow? > > is there anything wrong with such a simple way as this, as far as > site-wide error handling or loss of tag trace info for logging? this > would be fine for 99% of the time (and the other 1% would be > "try->catch->rethrow" )? > ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
