Strange exception handling behavior

I just ran into an interesting little problem...

I have an ExceptionHandler defined so that I can give users a nice
Sorry, Something Went Wrong! page and log the exception. Works great.

I also had RequestEndHandler defined but the method it referred to didn't exist.

So, at the end of every request, having completely rendered the
requested event correctly, ColdBox would try to call the request end
handler, which would throw an exception and ColdBox would then run the
ExceptionHandler - even tho' there's no possible way the handler could
display anything vaguely useful at this point since the (correct) view
has already been rendered.

Surely, any exceptions occurring *after* the request has completed
should be displayed as bare exceptions?

This had been happening in our application - silently - for ages and
we only spotted it because we enhanced our logging and saw strange
values appearing (reports of pages not found that were clearly present
and rendering just fine). Since the event being reported as apparently
being invalid was clearly a valid, working event, this took a little
while to track down. Obviously defining the handler method or removing
the RequestEndHandler declaration both worked to solve the issue but
my point about handling exceptions at the end of the request lifecycle
still stands...

Yes, this is obviously a tricky situation as the request produced content and then post processing routines failed.

The exception handler will still fire for these errors and even a custom error template could be rendered since it has that in line 307 of the coldbox.cfc. So it could appear at the bottom of the request. Still, tricky situation.

Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform:
Linked In:
IECFUG Manager: