House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home / Groups / ColdFusion Talk (CF-Talk)

cfcatch type="" problem

Author:
Adrian Lynch
11/21/2008 06:03 AM

I'm caching some objects in an admin object and I serve these cached object up in a method, admin.getService("myService"). Some simplifed code: <cfif NOT StructKeyExists(VARIABLES.services, ARGUMENTS.service) OR ARGUMENTS.refresh>   <cftry>     <cfset VARIABLES.services[ARGUMENTS.service] = CreateObject("component", "cfc.#ARGUMENTS.service#Service").init()>     <cfcatch type="any">       <cfthrow type="" message="No such service: #ARGUMENTS.service#<br />#GetCurrentTemplatePath()#">     </cfcatch>   </cftry> </cfif> The try/catch is there to trap calls to service CFCs that don't exist. admin.getService("notAService") will throw an exception: No such service: notAService C:\path\to\template.cfc The trouble with the try catch is that it also traps errors in the service object. I've tried changing the type of the catch so I only catch the non-existent CFC exceptions but none seem to work. Any suggestions? Thanks. Adrian Lynch http://www.halestorm.co.uk/ http://www.adrianlynch.co.uk/


Search cf-talk

March 15, 2010

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31