macromedia.coldfusion.cfml_general_discussion
[Top] [All Lists]

Re: Easy <cftry> question

Subject: Re: Easy <cftry> question
From: Adam Cameron <adam_junk@xxxxxxxxxxx>
Date: Tue, 29 Jul 2008 07:59:05 +0100
Newsgroups: macromedia.coldfusion.cfml_general_discussion

> It would be better to cflocate to index.cfm in your cftry block instead of 
> including the template and aborting.

It depends on the situation.  I would say Dan's position is a bit
"blanket".

Most of our processing code is done within CFC methods, so usually we throw
(or rethrow) an exception after whatever try/catch processing need needed
has taken place; then leave it to the calling (UI) code to decide whether
the exception can be ignored or not.  The UI handling of this might simply
be the default error template (which presents the message part of the
error, but skinned according to the website, for example).

Sometimes the best thing to have happen when a trapped exception occurs is
to pretty much halt processing, because - after all - the code that threw
the exception was there for a reason, and it's often not appropriate to
simply carry on as if it didn't have a problem.

To give you the short answer to your actual question:  There is no problem
using <cfabort> in these circumstances, provided it's the best handling of
the situation.  Although I'm not necessarily sure it's often the best way
of handling it.  There's plenty of situations in our code that we do this
very thing though.

-- 
Adam

<Prev in Thread] Current Thread [Next in Thread>