cfdeveloper
Programmer
Hello everybody,
I'm hoping someone can help me. I am working on this exception handling code. I have written a custom error handler that displays a custom error message when a coldfusion error occurs and sends an email to the administrator. I want to append the complete error
block to the email body. i.e essentially the raw error message you would see if you didn't have the cftry and cfcatch.
ex:
Error Occurred While Processing Request Variable NAME is undefined.
The error occurred in c:\inetpub\ line 494
Called from c:\inetpub\ line 457
Called from c:\inetpub\ line 226
Called from c:\inetpub\ line 1
492 : </cfif>
493 : , '#LSDateFormat(Now(),'yyyy/mm/dd')# #LSTimeFormat(Now(),'HH:mm:ss')#',
494 : '#Name#'
495 : )
496 : </cfquery
Here is my code:
<cftry>
<cfcatch type="any">
<cf_caughtIt catchMessage="#cfcatch.message#">
</cfcatch>
</cftry>
caughtIt.cfm
<cfparam name="attributes.catchMessage" default="">
<CFMAIL
type="HTML"
FROM="#cgi.server_name#@domain"
TO="#administrator#"
SERVER="someserver"
PORT="25"
SUBJECT="#cgi.SCRIPT_NAME#">
<h2>Details</h2>
<cfif attributes.catchMessage neq "">
<cfdump var="#attributes.catchMessage#">
</cfif>
<h2>Form Info</h2>
<cfdump var="#form#">
<h2>URL Details</h2>
<cfdump var="#url#">
</CFMAIL>
I would appreciate your help
Regards,
cfcoder
I'm hoping someone can help me. I am working on this exception handling code. I have written a custom error handler that displays a custom error message when a coldfusion error occurs and sends an email to the administrator. I want to append the complete error
block to the email body. i.e essentially the raw error message you would see if you didn't have the cftry and cfcatch.
ex:
Error Occurred While Processing Request Variable NAME is undefined.
The error occurred in c:\inetpub\ line 494
Called from c:\inetpub\ line 457
Called from c:\inetpub\ line 226
Called from c:\inetpub\ line 1
492 : </cfif>
493 : , '#LSDateFormat(Now(),'yyyy/mm/dd')# #LSTimeFormat(Now(),'HH:mm:ss')#',
494 : '#Name#'
495 : )
496 : </cfquery
Here is my code:
<cftry>
<cfcatch type="any">
<cf_caughtIt catchMessage="#cfcatch.message#">
</cfcatch>
</cftry>
caughtIt.cfm
<cfparam name="attributes.catchMessage" default="">
<CFMAIL
type="HTML"
FROM="#cgi.server_name#@domain"
TO="#administrator#"
SERVER="someserver"
PORT="25"
SUBJECT="#cgi.SCRIPT_NAME#">
<h2>Details</h2>
<cfif attributes.catchMessage neq "">
<cfdump var="#attributes.catchMessage#">
</cfif>
<h2>Form Info</h2>
<cfdump var="#form#">
<h2>URL Details</h2>
<cfdump var="#url#">
</CFMAIL>
I would appreciate your help
Regards,
cfcoder