A CF error handler for CFAJAX calls
When calling a CF function via CFAJAX, CF errors can be hard to debug. This technique allows a useful error message to be displayed via a popup, speeding the fault diagnosis:
1) In the CF functions page you are calling via cfajax, add a cferror tag:
<cferror template="error.cfm" type="exception">
2) In the location pointed to by the cferror tag, put as error handling code:
<cfsetting showdebugoutput="false">
<cfoutput>alert("#JSStringFormat("Error:" & Error.Diagnostics)#");</cfoutput>
Now CFAJAX thinks everything is ok when a CF error occurs; it renders the return to the page instead of the normal CFAJAX return JS (which would be nothing because an error occurred) and the popup shows.

There are no comments for this entry.
[Add Comment]