• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Name

GetException

Synopsis

                   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>

PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint