On 10/4/07, Brian Kotek <[EMAIL PROTECTED]> wrote: > > I would add some kind of error handling, because right now if you pass in > anything other than "get" or "set", or any property that doesn't exist, it's > going to blow up.
Similar to Brian, I was going to say you should check that the missing method you want to handle matches some pattern you are looking for, and if not, throw the error that would have occurred. There may be some cases where you don't want to do that, but I think in most it would be beneficial. On 10/4/07, Adrian Lynch <[EMAIL PROTECTED]> wrote: > > > > > > Sorry for the cross post, this might be a better place for this > > question... > > > > Does anyone have an example onMissingMethod to show? Here is what I > > have. Anyone have anything different or spot anything wrong with mine? > > > > <cffunction name="onMissingMethod"> > > > > <cfargument name="missingMethodName" type="string" > > required="true"> > > <cfargument name="missingMethodArguments" type="struct" > > required="true"> > > > > <cfset var action = Left(ARGUMENTS.missingMethodName, 3)> > > <cfset var property = Right(ARGUMENTS.missingMethodName, > > Len(ARGUMENTS.missingMethodName) - 3)> > > > > <cfif action EQ "get"> > > <cfreturn VARIABLES[property]> > > <cfelseif action EQ "set"> > > <cfset VARIABLES[property] = > > ARGUMENTS.missingMethodArguments [1]> > > </cfif> > > > > </cffunction> > > > > Ta. > > > > Adrian > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CFCDev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfcdev?hl=en -~----------~----~----~----~------~----~------~--~---
