Error notification
Here is some code I just used to catch duplicate title errors at Extended Tribe:


... CFML code ...


<CFTRY>

The insert record behavior goes here.

<CFCATCH type="database">

<CFIF cfcatch.NativeErrorCode EQ 0>

 <cflocation url="duptitle.cfm">

<CFELSE>

<CFMAIL TO="miles@txspt.com"
FROM="info@coldfusionhost.biz"
server="mail.coldfusionhost.biz"
                username="info@coldfusionhost.biz"
                password="t1nker53"
SUBJECT="Error on #GetCurrentTemplatePath()#">
TYPE:
#CFCATCH.type#

MESSAGE:
#CFCATCH.message#
</CFMAIL>
<cflocation url="errorpage.cfm">

</CFIF>

</CFCATCH>
</CFTRY>

This method works because I made the title field in Access indexed with no duplicates. Having dedicated pages for the error notification is a good idea, too.

Yeah!

Archives