You can't specify errorhandlers per event, but you can achieve want you need
to using request formats.
ModelGlue.xml
<event-handler name="page.scheduledTask">
<broadcasts>
<message name="setRequestFormat">
<argument name="format" value="scheduledTask" />
</message>
</broadcasts>
<results>
<result do="template.main" />
</results>
<views>
<include name="body" template="pages/index.cfm" />
</views>
</event-handler>
<!-- An error event to show when an error occurs, much like <cferror>. -->
<event-handler name="page.error">
<broadcasts />
<results format="scheduledTask">
<result do="something.else" />
</results>
<results>
<result do="template.main" />
</results>
<views>
<include name="body" template="pages/exception.cfm" />
</views>
</event-handler>
In your controller
<cffunction name="setRequestFormat">
<cfargument name="event" />
<cfset event.setValue("requestFormat", event.getArgument("format", "html"))
/>
</cffunction>
I like broadcasting the setRequestFormat message because then its clear
whats going on, but alternatively you could just have a naming convention
for your scheduled task and broadcast a determineRequestFormat message in
the error handler which would figure it out, but then its not so easy to
follow
Chris
2009/8/4 Sir Rawlins <[email protected]>
>
> Hello Guys,
>
> Is it possible to set a different exception handler for certain
> events? I have events which are executed as scheduled tasks and rather
> than returning the exception as a view I'm looking to email it to
> myself so I can monitor what's going on.
>
> Is there an easy way to define a different handler in the XML for
> certain events?
>
> Cheers all,
>
> Rob
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en
For more about Model-Glue, check http://www.model-glue.com .
-~----------~----~----~----~------~----~------~--~---