Errors in ColdBox and trapping revisited with AoP mixed in for a smoother experience

Luis,

I had been thinking about this a lot and here is my eventual solution, that I hope you might consider adopting into ColdBox. As for the current reporting this will not change, but what will change is in places that are not going to get trapped.

So what I am proposing is an announcement point, so for example with the following snippet of code that is in the HandlerService that uses the InvalidEvent.

getUtil().throwit(message=“The event: #arguments.event# is not valid registered event.”,type=“HandlerService.EventHandlerNotRegisteredException”);

We could announce and an interception point like this

<cfset announceInterception('onError’, data) />

getUtil().throwit(message=“The event: #arguments.event# is not valid registered event.”,type=“HandlerService.EventHandlerNotRegisteredException”);

Or even better maybe within the throwit functions, but the problem I have with that then is how to tell whether it is a serious or minor error. Serious means there is no more interaction with the user, minor means it was thrown but can be trapped later on in the life cycle.

This is just a thought, because I might like to see more info in the logs for instance. And this would be a perfect way to not only do just that, but it might be a way for auditing / reporting further down the track as well.

Regards,

Andrew Scott

http://www.andyscott.id.au/

Luis,

I had been thinking about this a lot and here is my eventual solution, that I hope you might consider adopting into ColdBox. As for the current reporting this will not change, but what will change is in places that are not going to get trapped.

So what I am proposing is an announcement point, so for example with the following snippet of code that is in the HandlerService that uses the InvalidEvent.

getUtil().throwit(message=“The event: #arguments.event# is not valid registered event.”,type=“HandlerService.EventHandlerNotRegisteredException”);

We could announce and an interception point like this

<cfset announceInterception('onError’, data) />

getUtil().throwit(message=“The event: #arguments.event# is not valid registered event.”,type=“HandlerService.EventHandlerNotRegisteredException”);

Or even better maybe within the throwit functions, but the problem I have with that then is how to tell whether it is a serious or minor error. Serious means there is no more interaction with the user, minor means it was thrown but can be trapped later on in the life cycle.

This is just a thought, because I might like to see more info in the logs for instance. And this would be a perfect way to not only do just that, but it might be a way for auditing / reporting further down the track as well.

Regards,

Andrew Scott

http://www.andyscott.id.au/

No but I did find that you have an onException which is what I was looking for.

Regards,

Andrew Scott

http://www.andyscott.id.au/