Copy link to clipboard
Copied
I am trying to setup and error reporting system for my webpage the will email when an exception occurs on a specific page. I like all the information that is present in the standard exceptions message and want to email taht exact content.
<cftry>
<!--- Code --->
<cfcatch type="any">
<div id="cat">ERROR !!! <cfoutput>#CFCATCH.Message#</cfoutput></div>
<div id="copy">
An Error has occured and an error notification has been sent. Please use the back button on your browser and check your data if you recieve this error more than once please try again later.
</div>
<cfmail to="Email -address" subject="OPCD Summer Job Report Error - #now()#" from="auto_error_reporting@law.ou.edu" server="hamilton.law.ou.edu" type="html">
<cfdump var="#form#">
<cfrethrow>
<cfdump var="#cfcatch#">
</cfmail>
</cfcatch>
</cftry>
I know that <cfrethrow> aborts page processing, is there was way to duplicate all the information generated in the <cfrethrow> without aborting the page processing?
<cfdump var="#cfcatch#"> is not what i am looking for.
Copy link to clipboard
Copied
DLewey wrote:
<cfdump var="#cfcatch#"> is not what i am looking for.
Why not? The cfcatch structure is all the data about the excetption. If you don't want it formated as a dump table generated by the <cfdump...> tag. Write your own format using <cfoutput>#cfcatch.akey#</cfoutput>.
<cfrethow> does not abort page processing in and of itself. It just rethrows the exception outside of the current try/catch block. If there are other exceptions handling routines outside the current try/catch block, they will handle the retrhown exception. If not, then the page is aborted with the normal, default, built-in exception handler of the ColdFusion engine.
Copy link to clipboard
Copied
This may be what you want, I'm not sure your email is getting sent out when the cfrethrow is inside the mail tag.
That may be why you are thinking things are getting aborted, and hence not receiving the email.
<cfcatch type="any">
<div id="cat">ERROR !!! <cfoutput>#CFCATCH.Message#</cfoutput></div>
<div id="copy">
An Error has occured and an error notification has been sent. Please use the back button on your browser and check your data if you recieve this error more than once please try again later.
</div>
<cfmail to="Email -address" subject="OPCD Summer Job Report Error - #now()#" from="auto_error_reporting@law.ou.edu" server="hamilton.law.ou.edu" type="html">
<cfdump var="#form#">
<cfdump var="#cfcatch#">
</cfmail>
<cfrethrow>
</cfcatch>
</cftry>
Byron Mann
Software Architect
hosting.com | hostmysite.com
http://www.hostmysite.com/?utm_source=bb