<cfthrow>

The cfthrow tag raises a developer-specified exception that can be caught with <cfcatch> tag having any of the following type specifications

  • cfcatch type = 'custom_type'
  • cfcatch type = 'Application'
  • cfcatch type = 'Any'

This tag cannot have a body.

This tag is also supported within <cfscript>

<cfthrow type=string message=any detail=string errorcode=string extendedinfo=string object=any contextlevel=numeric >
Attribute Description
type
string, optional

A custom type or the predefined type Application. Do not enter any other predefined types because they are not generated by CFML applications.

If you specify the exception type Application, you need not specify a type for cfcatch, because the Application type is the default cfcatch type

message
any, optional

A message that describes the exceptional event.

detail
string, optional

A detailed description of the event. The CFML server appends the position of the error to this description; the server uses this parameter if an error is not caught by your code.

errorcode
string, optional

A custom error code that you supply.

extendedinfo
string, optional

extended information to the exception.

object
any, optional

A native Java exception Object, if this attribute is defined, all other attributes are ignored

contextlevel
numeric, optional

entry context level

* hidden *

Examples

<cftry>
    <cfthrow message="test exception">
    <cfcatch name="test" type="any">
        <cfdump var="#cfcatch#">
    </cfcatch>
</cftry>

See also