Whatever message this page gives is out now! Go check it out!

GetException

Last update:
May 18, 2026

Description

Used with the cftry and cfcatch tags. Retrieves a Java exception object from a Java object.

Returns

Any Java exception object raised by a previous method call on the Java object.

Category

Syntax

GetException(object)

Parameters

Parameter
Description
object
A Java object.

Usage

ColdFusion stores a Java exception object for each method call on a Java object. Subsequent method calls reset the exception object. To get the current exception object, call GetException on the Java object before other methods are invoked on it.

Example

<!--- Create the Java object reference ---> 

<cfobject action = create type = java class = primativetype name = myObj> 

<!--- Calls the object's constructor ---> 

<cfset void = myObj.init()> 

<cftry> 

<cfset void = myObj.DoException() > 

<Cfcatch type = "Any"> 
 <cfset exception = GetException(myObj)> 

<!--- User can call any valid method on the exception object.---> 
 <cfset message = exception.toString()> 
 <cfoutput> 
 Error<br> 
 I got exception <br> 
 <br> The exception message is: #message# <br> 
 </cfoutput> 

</cfcatch> 

</cftry>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page