I'd probably throw an exception and let the calling page catch it if it wants to. By using a return code, you're allowing the calling page to ignore a failure, while an exception forces the calling page to explicitly deal with the exceptional circumstance. You could just let the DB exception trickle up, but that's breaking encapsulation, so you should throw an OperationFailed exception, or something generic like that, and declare that it can be thrown either in the HINT attribute, or in the non-standard THROWS attribute.
cheers, barneyb On 10/19/05, Will Tomlinson <[EMAIL PROTECTED]> wrote: > ok, here's what I'm using in my cfc. Is this an ok way to handle it? > > <cffunction name="deleteProduct" access="public" returntype="numeric" > hint="Deletes a product"> > <cfargument name="prodID" required="yes" type="numeric" hint="Need one > product ID"> > <cfset var complete = 1> > <cfset var deleteproduct = ""> > <cftry> > <cfquery datasource="#VARIABLES.dsn#" name="deleteproduct"> > DELETE FROM tblproducts > WHERE prodID = <cfqueryparam cfsqltype="cf_sql_integer" > value="#ARGUMENTS.prodID#"> > </cfquery> > <cfcatch type="database"><cfset complete = 0></cfcatch> > </cftry> > <cfreturn complete> > </cffunction> > > If something screws up, I set complete to 0. Then in my page, I check to see > if it's 0, and display a message. > > Thanks, > Will > > -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 100 invites. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:221682 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

