Did you know that Model-Glue can run an event when an error occurs? This is a handy way to handle errors and works out of the box. However, this error handling only works if the framework itself can load. For fun, quickly rename your Model-Glue mapping and see what your site does. Most likely you will get a 'naked' error as Model-Glue was never able to load and handle your error.

While renaming the mapping isn't something that would normally happen in production, one error I have seen multiple times is a timeout error. On RIAForge for example, if I restart ColdFusion and then hit the site, the first two hits or so will get this error. As we know, Model-Glue loads up a lot of stuff during the first hit, so this isn't too surprising.

So how would you handle this? Simple - just add the good old <cferror> tag to your Application.cfm file. You won't be able to use any values from Model-Glue (like an email address for the administrator), but you could at least hard code something quick and dirty to handle the error. Here is a quick (and ugly) example:

<h2>Sorry, an error occurred!</h2>

<p> We have top people on it. Really. </p>

<cfmail to="ray@camdenfamily.com" from="ray@camdenfamily.com" subject="Error on Site X" type="html"> <cfdump var="#error#"> </cfmail>