RE: [coldbox:3232] Re: Including layout with CustomExceptionTemplate

The problem with this is that the error template is a catch all sort of
thing and shouldn't really rely on any thing else in the framework.
What if the framework is borked? You can't really guarantee that your
settings or anything exist. As much of a pain as it is, we keep our
CustomErrorTemplate completely stand alone so it can display even if
everything else on the server has gone down. This means that we have to
hard code the file paths and style sheets as opposed to our normally
very dynamic layouts.

If you want to have two levels of error messages, then specify an
ExceptionHandler setting, and use setNextRoute to try and redirect to a
more friendly error event if you can after logging the error. I'm not
sure if you can get in an endless loop that way though.

~Brad

Hi Guys,

You can use setNextEvent after logging your exception.

@brad you are right that in some cases its a endless loop. For example
if you have error in coldbox.xml.cfm file then this could be endless
loop.
But If you are sure that main stuff is without error then setNextEvent
is more appropriate to use for displaying user friendly error page.

Another way to have a ErrorPage.cfm and if there's any error then
redirect to this standalone page.

Thanks
Sana

My concern with using the "CustomErrorTemplate" is that you're still
relying on the framework to get you there. So I do the following:

1. I use the "ExceptionHandler" setting and redirect to a view that
uses a layout with no database dependency. So if the framework is
good, it should be able to display a simple html error page.

2. If the framework is borked then I can't depend on it so I have a
cferror tag in application.cfc with a template that is completely
standalone.

So the framework catches what it can and if something really funky
happens then that's caught by the cferror template which is
standalone.

- Gabriel