Adobe COLDFUSION 9 Manual page 1194

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using Web Elements and External Objects
Handling exceptions
Use the
and
cftry
cfcatch
Specify
1
type="coldfusion.runtime.corba.CorbaUserException"
exceptions.
Use the
2
cfcatch.getContents
The
cfcatch.getContents
exception.
The following code example shows the IDL for a CORBA object that raises an exception defined by the
PrimitiveException exception type definition, and the CFML that catches the exception and displays the contents of
the object.
IDL
interface myInterface
{
exception PrimitiveException
{
long l;
string s;
float f;
};
void testPrimitiveException() raises (PrimitiveException);
}
<cftry>
CFML
<cfset ret0 = handle.testPrimitiveException()>
<cfcatch type=coldfusion.runtime.corba.CorbaUserException>
<cfset exceptStruct= cfcatch.getContents()>
<cfdump var ="#exceptStruct#">
</cfcatch>
</cftry>
CORBA example
The following code shows an example of using a LoanAnalyzer CORBA object. This simplified object determines
whether an applicant is approved for a loan based on the information that is supplied.
The LoanAnalyzer CORBA interface has one method, which takes the following two in arguments:
• An Account struct that identifies the applicant's account. It includes a Person struct that represents the account
holder, and the applicant's age and income.
• A CreditCards sequence, which corresponds to the set of credit cards the user currently has. A member of the
CardType enumerator represents the credit card type. (This example assumes that the applicant has no more than
one of any type of card.)
The object returns a Boolean value indicating whether the application is accepted or rejected.
tags to catch CORBA object method exceptions thrown by the remote server, as follows:
method to get the contents of the exception object.
method returns a ColdFusion structure containing the data specified by the IDL for the
Last updated 8/5/2010
in the
tag to catch CORBA
cfcatch
1189

Advertisement

Table of Contents
loading

Table of Contents