User Guide

338 Chapter 2: ColdFusion Tags
cfthrow
Description
Throws a developer-specified exception, which can be caught with a cfcatch tag that has any of
the following
type attribute options:
type = "custom_type"
type = "Application"
type = "Any"
Category
Exception handling tags, Flow-control tags
Syntax 1
<cfthrow
type = "exception_type "
message = "message"
detail = "detail_description "
errorCode = "error_code "
extendedInfo = "additional_information"
object = "java_except_object">
Syntax 2
<cfthrow
object = #object_name#>
See also
cferror, cfrethrow, cftry,
Chapter 14, “Handling Errors,” in Developing ColdFusion MX
Applications
History
ColdFusion MX: Changed thrown exceptions: this tag can throw ColdFusion component
method exceptions.
Attributes
Attribute Req/Opt Default Description
type Optional Application A custom type
Application
Do not enter another predefined type; types are not
generated by ColdFusion applications. If you specify
Application, you need not specify a type for
cfcatch.
message Optional Message that describes exception event.
detail Optional Description of the event. ColdFusion appends error position
to description; server uses this parameter if an error is not
caught by your code.
errorCode Optional A custom error code that you supply.
extendedInfo Optional A custom error code that you supply.
object Optional Requires the value of the
cfobject tag name attribute.
Throws a Java exception from a CFML tag.
This attribute is mutually exclusive with all other attributes of
this tag.