exceptionHandling

Hi guys,

I seem to be having some issues with the errorHandling in my app.

My handlers extend a base handler which contains an onError method. Any errors which occur in the handlers "should" get trapped by that method and then returned back to the user as formatted JSON. I purposely forced an error in a handler and it appears that the onError method is NOT firing because CB just sends back the default exception page. When I look at the output the exception page does indicate the error that I forced. What I can't figure out though is why the onError function in my base handler is not firing.

Any ideas?

Thanks.

Nolan

Nolan,

I just created a new ColdBox application with the attached code. The onError function executed as I expected.

-Aaron

BaseHandler.cfc.txt (1.77 KB)

General.cfc.txt (3.11 KB)

Seems to work for me as well. What type of error are you forcing? A quick exception error was caught by my base handler

component extends=“Base” {

public void function index(event){
var rc = event.getCollection();
rc.number = 10/0;
}

}

component {

public void function onError(event,action,exception){
writeDump(arguments);
abort;
}

}

HI guys,

Thanks for your emails. Digging into it more I determined that onError was firing, however within that method the order of execution was bubbling another issue. I have reworked how my baseHandler works and it is executing as expected. Thanks all.

Happy Sunday.

Nolan