A few days ago I promised I’d blog about the error templates I use. Obviously part of the template is set up to show the site’s look and feel and present a generic “We are so sorry, blah blah blah” type message. Outside of that though here is typically what I do with the error itself.
<cfmail to="me" from="me" subject="SiteX Error" type="html">
<cfdump var="#exception#" label="Exception">
<cfdump var="#cgi#" label="cgi">
<cfdump var="#form#" label="form">
<cfdump var="#url#" label="url">
As you can see - I just take a massive dump in the email. Typically this is all I need. Sometimes though I need the session info so I just add a dump of that. I also bring up information on top of the dumps when I think it will be helpful. So for example, on RIAForge, I have both a main site and any number of project sites. To help me see a bit quicker, I can add this on top:
Site: #cgi.server_name#<br />
URL: http://#cgi.server_name##cgi.script_name#?#cgi.query_string#<br />
I typically also make the URL hot to ensure I can click on it from my email program.
Another idea to consider is placing the exception.message value in the message subject. You may want to trim it at 500 characters or so to keep it readable in your mail program.
One last suggestion: When working locally, it helps if you can skip the whole email process. While SpoolMail is helpful, I’d rather just get the error immediately. What I do then typically is check the server name CGI variable. If it is my local version, I dump the exception to screen.