Dave Shuck said the following on 04/06/2011 12:29 PM:
> Is the full CFML engine-generated exception even available there?  Is
> there some kind of way I could leverage the plugin architecture for
> this?  I know there is an onError() in the plugins, but I believe that
> is specific to an exception generated within the plugin itself.
Actually, the handleException() plugin points are run just before the
exception is passed to the exception handler.  You can use this to
pre-process exceptions -- block them, do something to them or let them pass.

http://trac.mach-ii.com/machii/wiki/IntroToPlugins#AnatomyofthePluginCFC

You'll definitely want to read up on what's available in the Exception
object:

http://trac.mach-ii.com/machii/wiki/ExceptionHandling

More importantly, there is an exception of using the handleException()
method.  You indicated you need the original exception stack.  You can
get that in the Exception obj by calling getCaughtException():

http://trac.mach-ii.com/machii/wiki/ExceptionHandling#HandlingUndefinedEventsinthehandleExceptionPluginPoint

<cffunction name="handleException" access="public" returntype="void"
output="true">
    <cfargument name="eventContext" type="MachII.framework.EventContext"
required="true" />
 
    <cfset var event = "" />
    <cfset var missingEvent = "" />
    <cfset var orginalException =
arguments.exception.getCaughtException() />

    <cfif arguments.eventContext.hasCurrentEvent()>
       <cfset event = arguments.eventContext.getCurrentEvent() />
    <cfelse>
       <cfset event = arguments.eventContext.getNextEvent() />
    </cfif>

    <!--- If it is due to the a missing event args and you'll want the
missing event as well, you need to do: --->
    <cfif arguments.exception.getType() EQ
"MachII.framework.EventHandlerNotDefined">
       <cfset missingEvent = event.getArg("missingEvent") />
    </cfif>

    <!---
        ...handle the missing event with a nice "Not Found" or "We Can't
Find What You're Looking For" page if you can't decipher from the
missing event what they were looking for...
        ...handle real exceptions by logging the exception, emailing the
developers, and presenting a nice view to the user...
     --->
</cffunction>

HTH,
Peter

-- 
Peter J. Farrell
[email protected]
[email protected]
http://blog.maestropublishing.com
Identi.ca / Twitter: @maestrofjp

-- 
To post to this group, send email to [email protected]
For more options and to unsubscribe, visit this group at 
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en

SVN: http://svn.mach-ii.com/machii/
Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/

Reply via email to