You have to catch those in the template which calls the CFC method, because control never actually passes to the CFC containing the method if there is a problem with the argument. Yet another case where MM's strongly/loosely typed hybrid system makes things difficult on the developer.
One solution would be to declare all your arguments as type="any", thereby allowing anything in, and then do manual typechecking inside your method, where you'd have full control to do whatever was necessary should the checks fail. Cheers, barneyb > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Bryan F. Hogan > Sent: Thursday, June 03, 2004 9:11 AM > To: [EMAIL PROTECTED] > Subject: [CFCDev] Catching Argument Type Errors > > Can someone tell me how if it is possible to catch argument > type errors? > > For example: > > <cffunction name="test" access="public" returntype="numeric" > output="false"> > <cfargument name="testValue" required="yes" type="numeric"> > > <cfset var testReturn=(arguments.testValue*10)> > > <cfreturn testReturn> > </cffunction> > > If invoke it like: > > <cfdump var="#test('test')#"> > > I don't want my error handler thrown. I want to catch that > error within > the component, pass it to another component to log it and/or > display a > friendly error. > > Is there a way to catch argument type errors? > ---------------------------------------------------------- > You are subscribed to cfcdev. To unsubscribe, send an email > to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' > in the message of the email. > > CFCDev is run by CFCZone (www.cfczone.org) and supported > by Mindtool, Corporation (www.mindtool.com). > > An archive of the CFCDev list is available at > www.mail-archive.com/[EMAIL PROTECTED] > ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
