RE: [coldbox:12197] What do you need to get the ExeptionBean to work?

You’ve got several questions here. What exactly are you wanting to happen when your site errors?

Minimally speaking, if you want to get an E-mail and let the user see a pretty error page, then check out the following settings:
The “CustomErrorTemplate” setting will replace the generic “Oops” bug report page with a .cfm file of your choosing apologizing to your user for the unforeseen issue your site just experienced.

If you are on an older version of ColdBox, there are the following settings to E-mail you when an error happens:

bugTracers =
{
enabled = true,
bugEmails = “xxx@xxx”,
mailFrom = “xxx@xxx”,
customEmailBugReport = “”
};

That functionality has been deprecated lately in favor of LogBox. Configure an Appender (such as an E-mail appender) that listens for error log messages and it will kick in when an error occurs to let you know.

Now, if you are wanting to get more funky than simply outputting a custom “oops” page and E-mailing yourself, you have two options.

The first is the exception handler setting that you set up in your config file with the “ExceptionHandler” setting. This is a ColdBox handler/action that accepts a variable in the request collection called “ExceptionBean”. In addition to running whatever code you want, you can use setNextEvent() to highjack the request and send the user wherever you want. If you don’t do that, ColdBox will eventually output your CustomErrorTemplate (or the default bug report template if that isn’t set).

The second option you have is to register an interceptor that listens to the “onException” interception point. The framework will call this whenever an exception occurs and the interceptData struct will have a key called “exception” which is the cfcatch that was caught. You can pretty much do whatever you want in this interceptor as well, including redirecting to an other event.

You can also have an exceptionHandler setting configured along with an onException interceptor and they will both fire, starting with any interceptors, then the handler.

Thanks

~Brad