Yeah, just use CFERROR in your application.cfm and then set the
site-wide error handler in the CF Administrator.  From there, use any
code you want.  This is the code that I use in my error handler page,
and I store the data in a database:

<!---
error.cfm - 11/4/2003 PBR
Global error handling page.  Dumps all debug information into the
database.
--->
<cfoutput>
<!--- Build the debug information --->
<cfscript>
tmp = structNew();

tmp.date_time = error.datetime;
tmp.message = error.message & " (" & error.rootCause.tagContext[1].ID
& "/" & error.rootCause.tagContext[1].TYPE & ")";
tmp.diag_info = error.diagnostics;
tmp.file_location = error.rootCause.tagContext[1].TEMPLATE & "|" &
error.rootCause.tagContext[1].LINE & "|" &
error.rootCause.tagContext[1].COLUMN;
tmp.server = CGI.http_host;
tmp.data_pkg = error;

tmp.full_scope_pkg = structNew();
tmp.full_scope_pkg.http = structNew();
tmp.full_scope_pkg.http = getHTTPRequestData();
tmp.full_scope_pkg.cgi = structNew();
tmp.full_scope_pkg.cgi = cgi;
tmp.full_scope_pkg.server = structNew();
tmp.full_scope_pkg.server = server;
tmp.full_scope_pkg.application = structNew();
tmp.full_scope_pkg.application = application;
tmp.full_scope_pkg.request = structNew();
tmp.full_scope_pkg.request = request;
tmp.full_scope_pkg.session = structNew();
tmp.full_scope_pkg.session = session;
tmp.full_scope_pkg.url = ""> tmp.full_scope_pkg.url = ""> tmp.full_scope_pkg.client = structNew();
tmp.full_scope_pkg.client = client;
tmp.full_scope_pkg.form = structNew();
tmp.full_scope_pkg.form = form;

tmp.scope_pkg = tmp.full_scope_pkg;
</cfscript>
<!--- Convert structures to WDDX --->
<cfwddx action="" input="#tmp.data_pkg#"
output="tmp.data_pkg_out" usetimezoneinfo="Yes">
<cfwddx action="" input="#tmp.scope_pkg#"
output="tmp.scope_pkg_out" usetimezoneinfo="Yes">
<!--- Insert data --->
<cftransaction action=""> <cfquery name="insError" datasource="error">
INSERT INTO
tblErrors(date_time,message,diag_info,file_location,server,data_pkg,scope_pkg)
VALUES
(#tmp.date_time#,'#tmp.message#','#tmp.diag_info#','#tmp.file_location#','#tmp.server#','#tmp.data_pkg_out#','#tmp.scope_pkg_out#')
</cfquery>
<cfquery name="getID" datasource="error">
SELECT @@identity AS tmp_id
</cfquery>
</cftransaction>
<script language="_javascript_" type="text/_javascript_">
<!--
function errorNav(item) {
if (item.a[0].checked == true) {
history.go(-1);
return false;
} else if (item.a[1].checked == true) {
location.href='';
return false;
} else {
item.submit();
return true;
}
}
//-->
</script>
#getID.tmp_id#
<h1>An error has occurred.</h1>
<p>There has been a problem with the request you are trying to make.
You have several options:</p>
<blockquote>
<form name="error" id="error" action="" method="get"
errorNav(document.error)">
<input type="hidden" name="id" value="#getID.tmp_id#">
<input type="radio" name="a" id="a_try_again" value="try_again"
checked="checked"><label for="" Return to the previous page
and try again.</label><br />
<input type="radio" name="a" id="a_cancel" value="cancel"><label
for="" Cancel and return to the events listing.</label><br />
<input type="radio" name="a" id="a_submit_help"
value="submit_help"><label for="" Cancel and submit a help
request.</label><br /><br />
&nbsp; &nbsp; &nbsp; <input type="submit" value="Submit"> &nbsp;
<input type="reset" value=" Reset ">
</form>
</blockquote>
<div align="center"></div>
</cfoutput>

Ketan Patel wrote:
> Hi,
> Does anybody know about a Site-wide Error Handler Script which works on CFMX
>
> Ketan Patel
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to