Yeah, that is pretty simple. In your ColdSpring.xml you have a modelglue.ModelGlueConfiguration definition and you'll find a setting for defaultExceptionHandler:
<property name="defaultExceptionHandler"><value>Exception</value></property> Just configure that event handler to do what you want. I have mine check a setting to figure out whether I'm on a development environment (unfriendly error) or production (friendly error). <event-handler name="Exception"> <broadcasts> <message name="NeedErrorResult" /> </broadcasts> <results> <result name="unfriendly" do="UnfriendlyException" /> <result name="friendly" do="FriendlyException" /> </results> </event-handler> <event-handler name="UnfriendlyException"> <views> <include name="body" template="exception/Exception.cfm" /> </views> </event-handler> <event-handler name="FriendlyException"> <views> <include name="errorcontent" template="exception/Exception.cfm" /> <include name="email" template="exception/SendExceptionMessage.cfm" /> <include name="body" template="exception/FriendlyException.cfm" /> </views> </event-handler> On Wed, Jan 26, 2011 at 10:30 AM, Ryan Stille <[email protected]> wrote: > I have been doing permission checking (in my controller) when updating > records something like this (simplified code): > > <cfset dataBean = > loadBean(arguments.event.getValue("ID_passed_in_from_form") ) /> > > <cfif dataBean.getOwner() EQ Session.owner> > then allow things to happen now > <cfelse> > <cfthrow message="Permission denied.... etc." /> > </cfif> > > The cfthrow is messy, but this is something I don't expect to happen > very often so I'm ok with it. But recently we changed our exception > template so that error messages are not displayed to the user. So now > they get no specific error. I would like to have a nicer looking > error page. I was thinking of changing the cfthrow line to something > like this: > > <cfset arguments.event.setValue("errorMessage","Permission > denied... etc.") /> > <cfset arguments.event.addResult("niceError") /> > > But I don't want to have to add a "niceError" result to all my > events. Is there some way to do this globally? Or a better way to do > all this? > > Thanks, > -Ryan > > -- > Model-Glue Sites: > Home Page: http://www.model-glue.com > Documentation: http://docs.model-glue.com > Bug Tracker: http://bugs.model-glue.com > Blog: http://www.model-glue.com/blog > > 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]<model-glue%[email protected]> > For more options, visit this group at > http://groups.google.com/group/model-glue?hl=en -- Plutarch - "The mind is not a vessel to be filled but a fire to be kindled." -- Model-Glue Sites: Home Page: http://www.model-glue.com Documentation: http://docs.model-glue.com Bug Tracker: http://bugs.model-glue.com Blog: http://www.model-glue.com/blog 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
