What sort of error were you creating in your custom tag?

If it's an error that occurs when the server tries to compile the code from
CFML to Java then the try/catch won't do anything. If it's an error that
occurs because of a runtime error such as a non-existant variable then it
should catch the error.

A simple way to check would be to add this to an otherwise good custom tag:

<cfthrow message="Oops! Something went wrong.">

If you get that output on the page you probably had a compile time error in
the custom tag.

Spike

--------------------------------------------
Stephen Milligan
Code poet for hire
http://www.spike.org.uk

Do you cfeclipse? http://cfeclipse.tigris.org


>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On Behalf Of Andrew Grosset
>Sent: Monday, August 30, 2004 9:05 PM
>To: CF-Talk
>Subject: cftry/cfcatch error handling
>
>I have a template which calls a custom tag (data.cfm). For
>testing puposes I deliberately caused an error to occur within
>the custom tag, the cfcatch/cftry block responds with any text
>I have written within the cftry tags but #cfcatch.message# is
>empty....If I cause an error to occur within the template that
>calls the tag (using url.test) then the catch.message is not
>empty.....anyone have any thoughts on how to handle errors
>when using custom tags?
>
><cftry>
>
><cfif IsDefined("url.test")>
>  <cfset a=b>
><cfelse>
>  <cf_data details="test">
></cfif>
>
><p>Testing 123..........
>
><cfcatch>
><h1>An error has occurred...</h1>
><cfoutput>
><p>cfcatch message=#cfcatch.message#</p>
></cfoutput>
></cfcatch>
>
></ctry>
>
>Andrew.
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to