Hi all,
I'm writing a whole bunch of CFCs for our company Intranet and I've come
up on this problem time and time again:
I code a lot of my CFCs in near-pure CFScript. For some reason in CFMX,
Macromedia have provided us with the try and catch statements, but not a
throw statement/function.
As one cannot break out from the CFScript, do some CFML and then go back
into CFScript like this:
<cfscript>
function SomeFunc(param1)
{
</cfscript>
<cfthrow .../>
<cfscript>
}
</cfscript>
we are forced to create a Throw function that is coded in CFML so we can
do our <CFTHROW/>.
This solution has problems, the biggest (for me) is the apparent fact
that any exception that occurs appears to CF to occur in our Throw()
function. This is of course due to the fact that the CFTHROW is in the
Throw() function.
If we pass an object from another exception to the CFTHROW via Throw()
the exception is displayed as having come from the correct place. This
is due to the fact that (all?) the exception(s) have an 'Exception
Context' which I think is a file/line/stack trace.
The questions are
a) how do I either modify a thrown exception that I wish to rethrow (but
with extra data)
b) how do I throw my own exceptions with an exception context?
If anyone can help here I would be very grateful. It could be a funky
Java solution, but my Java knowledge is not very great.
Cheers all,
Oliver Tupman
Key Systems Geotechnical.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
http://www.cfhosting.com
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4