RE: [coldbox:11959] ExceptionBean is undefined in the request collection (private=false)

My exception handler is “ehMain.onException”. As such, I have the following line in my config file:

exceptionHandler = “ehMain.onException”,

You are not supposed to call the exception handler directly. For instance, if you are typing the following in your web browser:
then you’re doing it wrong. That will surely error because there is no exception bean in the request collection.

If you want to test your exception handler, then you need to purposely create an error in another, real handler and ColdBox will automatically call the exception handler for you and it will pass in the exception bean.

Does that make sense?



I understand you very well, I also like my config file;

exceptionHandler = “Main.onException”

and development

coldbox.exceptionHandler = “Main.onException”;

but the application still does not work when I create also a exception, I do not like that directly to the visit http://localhost/Main/onException.



Check you rc by writedump(rc);writedump(prc); and find out ExceptionBean. This error normally occur because ExceptionBean is not available neither rc nor prc.
It is actually present as exception in prc.

So right code should be prc.exception.getMessage() and you can use other function of prc.exception…