Exception handling problem

Hi,

I want to prevent that coldbox shows a complete exception dump in
production.

As i understand there are several options:

- onException interceptor
- onException handler
- customer error template

None work like i want them.

Both onException (interceptor+handler), i am forced to do a
setNextEvent or the normal bugreport is rendered anyway.
I tried to do a renderData() call, with http status code 500 and a
message. But, as i said, the bug report is rendered.

setNextEvent is not good, because the exception might be in the layout
or somewhere else in an interceptor and i will get an infinite loop of
setNextEvents..

The problem with custom error template is that i want this file in an
external location, not in the wwwroot. And also i need to use
getSetting("environment"), which a view should not call..

How can i use renderData in exception handler, and prevent the
bugreport from being rendered instead of this data?

greets,
klaas

“setNextEvent is not good, because the exception might be in the layout
or somewhere else in an interceptor and i will get an infinite loop of
setNextEvents…”

  1. You can prevent an issue with the layout by having the error message event decoupled from the rest of the site. In other words, it would have its own layout that you know is guaranteed to work because it doesn’t have any coldbox dependencies. Essentially, it renders an html page and that’s it.

  2. If an interceptor doesn’t work, it may not be handled by the framework exception handling. You still want to have an onError method or cferror tag in your application.cfc to catch the really nasty bugs that may happen and prevent coldbox itself from ever properly setting itself up.

  • Gabriel

Also, the custom error template has full access to the controller object so you can build anything you need with it. Just be careful as an error on this template will cause the default template to fire also.

Also, teh custom error template can be ANYWHERE in the server as long as it can be included via cfinclude.

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