I was trying to implement Global onException Interceptor as described on http://wiki.coldbox.org/wiki/ExceptionHandling.cfm. When an exception happened, I got redirect loop message on my browser. Could anyone help me why I got redirect loop and how to fix it?
/config/Coldbox.cfc
I don’t have coldbox.exceptionHandler defined.
/interceptors/ExceptionHandler.cfc
component extends=“coldbox.system.Interceptor” {
function onException(event, interceptData){
var exception = arguments.interceptData.exception;
//writeDump(arguments.interceptData); // I can see the exception in interceptData.
//abort;
setNextEvent( “main.onException” );
}
}
/handlers/main.cfc
component {
function home(event, rc, prc) {
writeDump(foo);
}
function onException(event, rc, prc) {
//Grab Exception from private request collection, placed by ColdBox Exception Handling
var exception = prc.exception;
writeDump(exception);
abort;
}
}
So, when I called http://localhost/index.cfm?event=main.home, it redirected to main.onException because foo is not defined. Then, the redirect loop message showed up on the browser. I am puzzled.