Name
GetException —
Synopsis
GetException(object_name
)
Used in conjunction with the
CFTRY
/CFCATCH
tags,
GetException()
returns a Java exception object
thrown by the specified object.
The following example shows how to use
GetException()
with an imaginary Java object
called MyObject
:
<CFOBJECT TYPE="Java" ACTION="Create" CLASS="MyClass" NAME="MyObject"> <CFTRY> <CFSET Test = MyObject.CauseError() > <CFCATCH TYPE="Any"> <CFSET MyException = GetException(MyObject)> <!--- call the GetErrCode and GerErrMsg methods within the exception object ---> <CFSET ErrorCode = MyException.GetErrCode() <CFSET ErrorMessage = MyException.GetErrMsg()> <CFOUTPUT> Error Code: #ErrorCode#<BR> Error Message: #ErrorMessage# </CFOUTPUT> </CFCATCH> </CFTRY>
Get Programming ColdFusion 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.