Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
mherel #1
TRapping Errors from a Java Component
I am using "creatObject" to use a Java Class and need to have ColdFusion trap
any errors returned by this class. My code is as follows:
<cftry>
<cfset co = createObject("java", "CNRP_SP")>
<cfset CoBAP = co.CNRP_SP()>
<cfset CoTable = co.callBAPI(#arguments.BAPIName#, #arguments.queryTable#)>
<cfset CoTable.firstRow()>
<cfset count = #CoTable.getNumRows()#>
<!--- create a query --->
<cfset qSPtable = queryNew("Item, Company_Code, Company_Name")>
<cfloop index = "i" from = 1 to = #count#>
<cfset newrow = queryaddrow(qSPtable, 1)>
<!--- set values in cells --->
<cfset temp = querysetcell(qSPtable, 'Item', i)>
<cfset temp = querysetcell(qSPtable, 'Company_Code',
ToString(CoTable.getString("COMP_CODE")))>
<cfset temp = querysetcell(qSPtable, 'Company_Name',
ToString(CoTable.getString("COMP_NAME")))>
<cfset CoTable.nextRow()>
</cfloop>
<cfcatch>
Do Something Here - Errors in the Java code
never get caught here
</cfcatch>
</cftry>
In the Java code when I throw an error ColdFusion displays the text and stops
processing before it ever gets to <cfcatch>
Is there a way to handle this? How can I "catch" errors in CF?
TIA
mherel Guest
-
Trapping errors
Is there a way to implement a global error trap at the application level? I added an event listener on my application tag, but it doesn't trap the... -
WSDL Errors with Java and CF
hello. I'm trying to make a call to a Java WSDL service. The Java programmer says that nothing's wrong with the WSDL. Yet, I keep getting the... -
Trapping datatype errors for web methods
I've set up a web method with several parameters with UDT's using enums. If a user submits an entry with an invalid value, it throws an exception,... -
Trapping errors from stored procedure calls
We often use code in stored procedures for premature exit, such as SET @returnerror = @@ERROR IF ( @returnerror <> 0 ) BEGIN RAISERROR(... -
trapping compile time errors
Hi, I want to catch compile time errors with my own method. In Perl, you can do this: $SIG{__DIE__} = \¨ sub die { print "Error... -
mxstu #2
Re: TRapping Errors from a Java Component
Just guessing here, but did you try specifying the type of exception to catch?
<cfcatch type="java.lang.ArrayIndexOutOfBoundsException">
<cfdump var="#CFCATCH#">
</cfcatch>
mxstu Guest
-
mherel #3
Re: TRapping Errors from a Java Component
No, I left the specifics blank to try to catch any errors. I am not really a
java guy so I am not sure of the specifics for java errors. Can I be more
genereic and do something like:
<cfcatch type="java.lang">
<cfdump var="#CFCATCH#">
</cfcatch>
I am concerned though, that it looks like it never makes it to the "catch"
block...
mherel Guest
-
mherel #4
Re: TRapping Errors from a Java Component
Thanks a lot, that did the trick....
mherel Guest



Reply With Quote

