Is that the same way one should do it in Java as well? I sort of look at some code and see null or object being returned, and guess have that stuck in my head.
Thanks Barney / Sean. Regards, Andrew Scott Quote of the Day: Felix's Wife: Dr. Connors. I want to thank you for fixing Felix's back. He can even help around the house again. Phil Connors: I'm sorry to hear that, Felix -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Barney Boisvert Sent: Sunday, 23 October 2005 3:24 PM To: [email protected] Subject: Re: [CFCDev] CFC return types Here's the skeleton of the function: <cffunction name="getUser" returntype="userCFC"> ... <cfif doesUserExist> <cfreturn theUser /> <cfelse> <cfthrow type="UserNotFoundException" /> </cfif> </cffunction> And then calling it: <cftry> <cfset user = getUser() /> .. do stuff .. <cfcatch type="UserNotFoundException"> .. deal with the invalid user .. </cfcatch> </cftry> Just for references, with a "null" return value the function would return some kind of null instead of throwing the exception, and the calling code would look like this: <cfset user = getUser() /> <cfif user is null> .. deal with invalid user .. <cfelse> .. do stuff .. </cfif> cheers, barneyb On 10/22/05, Andrew Scott <[EMAIL PROTECTED]> wrote: > Barney, > > If you don't mind I would like an example to clarify, in this example I am > checking to see if a user exists, it returns the user object if it does. So > when it returns back to the caller how do I handle it, if you can give me an > example to help clarify what your saying that would be much appreciated. > > > Regards, > Andrew Scott -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 100 invites. ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). CFCDev is supported by New Atlanta, makers of BlueDragon http://www.newatlanta.com/products/bluedragon/index.cfm 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' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). CFCDev is supported by New Atlanta, makers of BlueDragon http://www.newatlanta.com/products/bluedragon/index.cfm An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
