Question about use of onException

8 views
Skip to first unread message

Judah McAuley

unread,
Dec 3, 2009, 6:33:46 PM12/3/09
to col...@googlegroups.com
I see onException listed as an interception point and also listed when
talking about customer framework error handling, but it isn't clear to
me whether you have to set up an ExceptionHandler and
CustomerErrorTemplate in your coldbox.xml file to get onException
working of if it will listen to exceptions regardless of those
settings.

Any clarification?

Thanks,
Judah

Luis Majano

unread,
Dec 3, 2009, 7:35:04 PM12/3/09
to col...@googlegroups.com
It is apart from the other two settings.  onException fires as an interceptor, separate from the handler and custom bug report.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com



--
You received this message because you are subscribed to the Google Groups "ColdBox: A ColdFusion Framework" group.
To post to this group, send email to col...@googlegroups.com
To unsubscribe from this group, send email to coldbox-u...@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For more information, visit http://www.luismajano.com/projects/coldbox
For Documentation, visit http://ortus.svnrepository.com/coldbox/trac.cgi

Judah McAuley

unread,
Dec 4, 2009, 12:28:33 PM12/4/09
to col...@googlegroups.com
Hmm..then I don't seem to using the intercept point correctly.

I'm trying to catch exceptions in an interceptor. This is my most basic form:

<cffunction name="onException" access="public" returntype="void"
hint="Executes whenever the framework detects an exception "
output="false" >
<cfargument name="event" required="true" type="any" hint="The
event object : coldbox.system.beans.requestContext">
<cfargument name="interceptData" required="true" type="struct"
hint="A structure containing intercepted information. NONE BY DEFAULT
HERE">

<cfscript>
variables.logger.error("An error occurred");
</cfscript>
</cffunction>

I know that the interceptor is registered correctly because my custom
intercept point is working. It is my understanding that I don't need
to announce this one because onException is a built in point. So I
should, I believe, just be able to define an onException method in my
intercept and it will get added to the list of things that listen for
exceptions, correct?

I do not have custom error handling defined in my app, so if I have an
error somewhere, I'd expect the framework to log the error and then
also see an additional error logged from my intercept that says "An
error occurred". Is that correct?

Currently, when I induce an error in my code by saying "foo = ;" in a
handler method somewhere, I see the exception logged by the framework
in my log file but nothing seems to be happening inside the
onException method I defined.

Also, what data should I have access to in this method? Is it the
cferror struct thrown by Coldfusion? Or is it an exception bean
created by Coldbox?

Thanks,
Judah

Luis Majano

unread,
Dec 4, 2009, 1:15:08 PM12/4/09
to col...@googlegroups.com
Dump the interceptdata and abort it in the onException so you can see what comes in. Also to see that it fires.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com


Reply all
Reply to author
Forward
0 new messages