Name

cfthrow

Synopsis

<cfthrow>

Creates a custom exception type that can be caught by the cftry/cfcatch tags when the type attribute of the cfcatch tag is set to Application, Any, or the custom type you specify in the cfthrow tag.

You can name custom exception types in a hierarchical manner so that you can reference groups of custom exception types with a single cfcatch tag. Consider the following cfthrow tag:

<cfthrow type="MyApp.RequiredParameters.MyVar">

Any of the three following cfcatch tags can be used to catch the exception:

<cfcatch type="MyApp.RequiredParameters.MyVar ">
<cfcatch type="MyApp.RequiredParameters">
<cfcatch type="MyApp">

Attributes

detail=" event_description "

Additional information to append to the detailed error information supplied by ColdFusion. Optional.

errorcode=" error_code "

A custom error code you want to make available. Optional.

extendedinfo=" extended_information "

Additional information regarding the error that you want to make available. Optional.

message=" error_message "

Message describing the event that triggered the exception. Optional.

object=" name "

Used to throw a Java exception from a CFML page. Name specifies the name of the object throwing the exception. This must be the same as the name attribute of the cfobject tag. Optional. If the OBJECT attribute is used, all other attributes are ignored.

type=" exception_type "

A name for the exception type. You may give the exception type a custom name or use the predefined types Application ...

Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.