GetException

Description

Used with cftry and cfcatch, this function allow you to retrieve a Java exception object from a Java object. Returns any Java exception object raised by the previous method call on the Java object.

Category

System functions

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, you must call getException on the Java object before any other methods are invoked on the object.

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>  







Banner.Novgorod.Ru