How about using the CFTRY/CFCATCH/CFTHROW tags. There are a number of different error trapping senerios that these tags provide that CFERROR does not provide.... i.e CFTRY/CFCATCH is more granular.
By Example
<cftry>
<cfquery>
a SQL Query
</cfquery>
<cfcatch type="database">
CF Code or HTML Code
(I'll have a custom tag here that will send an email as well as gracefully provide a _javascript_ alert box to prevent the end user from seeing the full error message)
</cfcatch>
</cftry>
There are other CFcatch exceptions for missing expressions and a whole host of other error conditions.
On the invalid email address, I don't think CFMAIL does not specifically look for bad email address before throwing an error -- and for this reason you are continuing processing the page. On the other hand you could error trap for this as well.
<cftry>
<cfif wrong_email_address>
<cfthrow type="Myapplication.missingvar"
message="Wrong Email Address"
Detail="email address must be created correctly"
errorcode="15">
<cfelse>
send email
</cfif>
<cfcatch type="Myapplication.missingvar">
Gracefully tell customer that email address is not correct
</cfcatch>
</cftry>
This way you can customize the error message based upon where the customer is located.
Jeremy
>Hi there
>
>I'm starting using handle error techniques in CF. Then I start with CFERROR
>tag.
>I test some possible causes of Exceptions like stoped SQL server when u try
>to query some table the application redirect to me without problems to the
>template file in CFError declaration.
>But when i try to send email to invalid email address(i know i can do it
>with regex, but remember i'm forcing exceptions jut to test cferror tag).
>The error is not trapped, the application continue without error..But when i
>check in exception log in the CF Server Administrator i see the exception...
>
>Any help ?
>
>Regards
>
>__
>MSc. Hassan Arteaga Rodríguez
>Microsoft Certified System Engineer.
>DIGI- Grupo de Desarrollo
>COPEXTEL, S.A.
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

