So, when I want to use a try/catch in a function, I usually do it like this:


<cfunction>
<cfargument>
<cfset var >
<cftry>
do stuff
<cfcatch>
    <cfreturn cfcatch>
</cfcatch
<cfreturn intededReturnVariable>
</cffunction>

This way, if I do catch an error I'm returning the cfcatch info. I guess 
you will have to do something a little different since you're returntype 
is set to query. I guess you could create a query object from the 
cfcatch information to return. Also, you're just doing an output-style 
dump, but your cffunction tag has output="false". I'm thinking that's 
not what you want to do.

--Ferg


Bryan Stevenson wrote:

>OK...I give up....here's the code:
>
>  <cffunction name="getHail" access="remote" returntype="query" 
>output="false" hint="Retrieves a core hail out record (hail 
>numbers/licences/trip types/periods can be retrieved via other available 
>methods). If a hailID and hailNumber are passed in, the hailID will be used 
>instead of the hailNumber">
>
>    <cfargument name="user"         type="string"   required="yes">
>  <cfargument name="pwd"          type="string"   required="yes">
>    <cfargument name="hailNum"      type="numeric"  required="yes" 
>hint="hail number of desired hail record (pass a zero if you want to ignore 
>this argument)">
>    <cfargument name="hailID"       type="numeric"  required="yes" 
>hint="activity ID of desired hail record (pass a zero if you want to ignore 
>this argument)">
>    <cfargument name="hailType"     type="string"   required="yes" 
>hint="type of hail (valid values are OUT and IN)">
>
>    <cftry>
>
>      <!--- we will lookup hail by activity ID for provided hail number - 
>lookup activity ID --->
>      <cfif Len(Trim(ARGUMENTS.hailNum)) AND NOT 
>Len(Trim(ARGUMENTS.hailID))>
>
>        <cfquery name="qGetActID" datasource="#datasource#" 
>username="#ARGUMENTS.user#" password="#ARGUMENTS.pwd#">
>          SELECT act_act_id
>            FROM #oschema#.hail_number
>           WHERE haiul_no = <cfqueryparam value="#ARGUMENTS.hailNum#" 
>cfsqltype="CF_SQL_NUMERIC">
>       </cfquery>
>        <cfset activityID = qGetActID.act_act_id>
>
>      <!--- hail number and hail ID (activity ID) passed to method - ignore 
>hail number and use hail ID to lookup hail --->
>      <cfelseif Len(Trim(ARGUMENTS.hailNum)) AND 
>Len(Trim(ARGUMENTS.hailID))>
>        <cfset activityID = ARGUMENTS.hailID>
>      </cfif>
>
>      <!--- lookup hail out record --->
>      <cfif Trim(ARGUMENTS.hailType) eq "OUT">
>        <cfset qGetHail = 
>CreateObject("component","appcfcs.fos.hails").getHailOuty(ARGUMENTS.user,ARGUMENTS.pwd,activityID)>
>      <!--- lookup hail in record --->
>      <cfelseif Trim(ARGUMENTS.hailType) eq "IN">
>        <cfset qGetHail = 
>CreateObject("component","appcfcs.fos.hails").getHailIn(ARGUMENTS.user,ARGUMENTS.pwd,activityID)>
>      </cfif>
>
>      <cfreturn qGetHail>
>
>      <cfcatch type="any">
>       <!---  <cfset qGetHail = packageError(cfcatch.errorMessage)> --->
>        <cfdump var="#cfcatch#"><cfabort>
>      </cfcatch>
>
>    </cftry>
>
>  </cffunction>
>
>I have forced an error by calling "getHailOuty" instead of "getHailOut" 
>(this condition is met <cfif Trim(ARGUMENTS.hailType) eq "OUT">).  The 
>cfcatch does NOT fire off and no dump of cfcatch scope occurs....instead I 
>get a standard fairly useless CF webservice error.
>
>Anybody?
>
>Bryan Stevenson B.Comm.
>VP & Director of E-Commerce Development
>Electric Edge Systems Group Inc.
>phone: 250.480.0642
>fax: 250.480.1264
>cell: 250.920.8830
>e-mail: [EMAIL PROTECTED]
>web: www.electricedgesystems.com 
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:220851
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to