-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Raymond Camden
Sent: Wednesday, 17 September 2003 0:39
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] qualifying data coming in to cfcThe CFC _does_ do validation, but it _wants_ to throw an error. What I mean is that my code in the method looks like this (PSEUDO-code!)function register(username,password) {if this user exists, cfthrow}There is no need for a cftry/catch inside because I _want_ an error to occur. Make sense?=======================================================================
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
Member of Team Macromedia
Email : [EMAIL PROTECTED]
Blog : www.camdenfamily.com/morpheus/blog
Yahoo IM : morpheus
"My ally is the Force, and a powerful ally it is." - Yoda-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tony Weeg
Sent: Tuesday, September 16, 2003 9:05 AM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] qualifying data coming in to cfcso you do not put the cftry/cfcatch block in the cfc, you wrap it around the call to it....any reason?tony weeg
sr. web applications architect
navtrak, inc.
[EMAIL PROTECTED]
www.navtrak.net
office 410.548.2337
fax 410.860.2337-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Raymond Camden
Sent: Tuesday, September 16, 2003 10:54 AM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] qualifying data coming in to cfcYes. For example, I have a register method of my User CFC that allows me to register a new user. It will throw an error if the user already exists. For security reasons, I don't expose my userExists method. So I just wrap the call to register w/ try catch.<!--- Attempt to register --->
<cftry>
<cfinvoke component="cflib.cfcs.user" method="register">
<cfinvokeargument name="username" value="#form.emailAddy#">
<cfinvokeargument name="password" value="#form.password#">
</cfinvoke>
<cfcatch>
<cfset errorMsg = cfcatch.message>
</cfcatch>
</cftry>=======================================================================
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
Member of Team Macromedia
Email : [EMAIL PROTECTED]
Blog : www.camdenfamily.com/morpheus/blog
Yahoo IM : morpheus
"My ally is the Force, and a powerful ally it is." - Yoda-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tony Weeg
Sent: Tuesday, September 16, 2003 8:49 AM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] qualifying data coming in to cfcnow do you wrap your in-cfc cfml code in cftry/cfcatch block to further prevent and trap errors?tony weeg
Title: Message
Possibly off-topic, but is generating an error the "right" way to do
this.
Is the
fact that the username/password combo already exists an "exceptional"
event?
I
usually try to return an integer indicating the result (similar to the
Win32 API) or return an object with status and
message.
Generating exceptions has significant overhead (stack traces get
generated, etc) so they shouldn't be used as programming logic like an "if"
statement. They should only be used for unexpected "exceptional"
events.
So
perhaps you should put a try/catch in the cfc for unexpected events and either
rethrow the error or return a status code or object.
Just
my two cents.
- RE: [CFCDev] qualifying data coming in to cfc Dave Carabetta
- RE: [CFCDev] qualifying data coming in to cfc Rod Buchan
- RE: [CFCDev] qualifying data coming in to cfc Raymond Camden
