<@U3RTMNQJG> Here is one of my error handlers. Its...
# cfml-general
d
@gavinbaumanis Here is one of my error handlers. Its very complicated but should give you an idea.
Copy code
public void function onError( exception, event )
{

	// Save the email body
	savecontent variable="local.body"
	{
		writeOutput("
		<h1>Error on Web Site</h1><br />
		<table><tr valign='top'><td>");
		writeDump(var:cgi,label:"CGI");
		writeOutput("</td></tr><tr><td>");
		writeDump(var:url,label:"URL");
		writeOutput("</td></tr><tr><td>");
		writeDump(var:form,label:"FORM");
		writeOutput("</td></tr><tr><td>");
		writeDump(var:arguments,label:"ERROR");
		if ( structKeyExists(session, "userInfo") )
		{
			writeOutput("</td></tr><tr><td>");
			writeDump(var:session,label:"SESSION");
		}
		writeOutput("</td></tr></table>");

	}

	// Send email
	application.smtpObj.sendEmail("#application.emailAddress#", local.body, "Error on Web Site");

}
👍🏼 1
p
One thing I like to do in onError is extend the timeout. What will happen if the page exceed the max timeout onError can fail to execute the code in onError, so I always
Copy code
setting requesttimeout=30;
Then log to somewhere ( not email as it's to annoying ) though HTMl emails do spew significant data if you dump the scopes so can be helpfull, just fills my inbox.
👍🏼 1
z
use sentry
👍 1
m
+1 for sentry.
👍 1
g
I have never heard of sentry before... I assume you use it with the CFML client, like; https://github.com/GiancarloGomez/sentry-cfml Which I found via Mr.Googles? Thanks!