I'd probably throw an exception and let the calling page catch it if
it wants to. By using a return code, you're allowing the calling page
to ignore a failure, while an exception forces the calling page to
explicitly deal with the exceptional circumstance. You could just let
the DB exception
]
Sent: Wednesday, 19 October 2005 1:36 PM
To: CF-Talk
Subject: RE: Using try/catch all over the place a good thing?
heh Bad Idea(tm) I like that
1. Your code has errors.
There are plenty of cases where you want no indication of an error to be
shown to a user (which is exactly what a site wide
There are cases where a try/catch block is
warranted, so long as it's used properly
What is the proper use and does it exclude catching
errors that might be thrown by a cffile or cfquery?
A proper use would be what you described, where you have a file coming in to
be imported and there
://acoderslife.com
-Original Message-
From: Justin D. Scott [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 19, 2005 8:01 AM
To: CF-Talk
Subject: RE: Using try/catch all over the place a good thing?
There are cases where a try/catch block is
warranted, so long as it's used properly
try/catch all over the place a good thing?
I missed commenting on the EVERYTHING since I thought he was
looking for a
solution to this...
I can see a problem though where the cffile might
work, then the query fails but you don't know it
you probably want to let the user know
You could not have planned it any better than that!!
Run that loop again LOL
On 10/19/05, Munson, Jacob [EMAIL PROTECTED] wrote:
I had a very funny experience with cftry/catch. I was taking
responsibility for a huge and kludgey application that was the result of
2-3 different developers
:) I would, but I don't maintain that app anymore (thankfully).
-Original Message-
From: Troy Simpson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 19, 2005 9:29 AM
To: CF-Talk
Subject: Re: Using try/catch all over the place a good thing?
You could not have planned it any
Done that as well, but evidently I was a lot more patient than you, as I
generated 34,000 emails!
Mike
-Original Message-
From: Munson, Jacob [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 19, 2005 10:21 AM
To: CF-Talk
Subject: RE: Using try/catch all over the place a good thing?
I
Another consequence of emailing errors, if you are sending diagnostic
info with the error (and you should be), you could be emailing
passwords, credit card numbers etc. etc. that are passed in the form
scope. Consider that when developing your error handling. I like to
store them in a db, with a
Also, consider using a site wide error handler AND a cferror tag AND,
on a granular level, cftry/cfcatch. Use cftry/cfcatch to protect
individual blocks of code where you want a specific error handled a
specific way (like a mime type failure on an upload). Use cferror as
your application's
http://acoderslife.com
-Original Message-
From: Munson, Jacob [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 19, 2005 11:21 AM
To: CF-Talk
Subject: RE: Using try/catch all over the place a good thing?
I had a very funny experience with cftry/catch. I was taking
responsibility
of the application.
Thanks for that input.
..:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
-Original Message-
From: Matt Robertson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 19, 2005 12:48 PM
To: CF-Talk
Subject: Re: Using try/catch all over the place a good thing
This is all great guys! Thanks for all the tips. Learnin' lots as usual.
Yeah, I'm specifically workin' with a file upload then insert query. I like the
try/catch approach because it drops the user right back where he was, not to
another page (error page) where he's trying to figure out what
ok, here's what I'm using in my cfc. Is this an ok way to handle it?
cffunction name=deleteProduct access=public returntype=numeric
hint=Deletes a product
cfargument name=prodID required=yes type=numeric hint=Need one product
ID
cfset var complete = 1
cfset var deleteproduct =
cftry
Any reason you can't just do this?
cftry
cffile action=
cfquery name=...
DE DO DO DO DE DA DA DA
/cfquery
cfcatch type=any/cfcatch
/cftry
..:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
-Original Message-
From: Will Tomlinson [mailto:[EMAIL PROTECTED]
I'm wrapping some cftry/catchs around my cffiles
and cfquerys. It works pretty sweet if I use
just an empty catch.
Hi Will, what is sweet about it, exactly? If your code is generating an
error, it means one of several things:
1. Your code has errors.
2. Your user is giving your code input
;)
..:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
-Original Message-
From: Justin D. Scott [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 18, 2005 10:51 PM
To: CF-Talk
Subject: RE: Using try/catch all over the place a good thing?
I'm wrapping some cftry/catchs
17 matches
Mail list logo