Heres the latest and greatest issue that leaves me biting my nails into the
wee hours of slumber..
Like most here I utilise the power of CFC's more so for everything that I
have ever done before, and I would like to setup a cftry / error catching
system on sensitive method calls cf (i.e. Query Calls, File Manipulation
etc). I also like most of you wish to keep all Presentation Layer Logic out
of the cfcs, thus allowing for both browser and flash to not suffer (or even
pda's but that's another email altogether).
Usually in the past prior to CFMX I used to do a try/catch on all queries,
in the event the datasource is down etc so that the end-user visiting the
site see's a warm fuzzy feeling "oops" page, while alerting me as to what's
happening so I can fix it.
Heres the scenario, I need to come up with a solution to allow the same
concept to be applied to the cfmx, I have separated my database interaction
from the "parent" component.. eg:
products = createObject("component","comp.products");
products.sql = createObject("component","comp.productsSQL");
Inside the SQL component I have cftry/catch between the cfcomponent tags,
and inside the cfcatch I do my usual logging/email outs etc, but I also then
define a new structure called "compERROR" and inside that I add my own
custom messages as well as appending the actual error message to this.
One theory we have is that when you make "sensitive" calls from the caller
page, you do an if/else statement directly after it to make sure that you're
expected returned results are safe i.e.:
<cfscript>
qProductRegions = products.sql.productRegionsSELECT();
</cfscript>
<cfif isDefined('compERROR')>cflocation to pretty page </cfif>
This basically works, but with as you can imagine some to if not allot of
limitations, especially when one assumes that its a direct call from the
actual caller page to the query component.. but in many cases the
presentation layer may not be making the direct call, it may be via a public
method which makes calls to private methods?
How would one then trap that error, and halt the overall process then and
there, while returning an error safely back to the presentation layer
without causing errors within errors... i.e. if you have a method expecting
a "query" result, and you return nothing, then that cfcomponent will
generate an error? so it never freakin stops.
I guess, what's peoples input on error catching and control with Coldfusion
Components.
--
Freelance Application Developer / Designer
--
ph: 07 3288 6702
mob: 04040 32812
--
url: http://www.spidaweb.com
---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MX Downunder AsiaPac DevCon - http://mxdu.com/