GetException
GetException(object_name
)
Used in conjunction with try/catch code, 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"> <cfset Test = MyObject.init( )> <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>