I respectfully disagree with not handling exceptions and let them raised in the player. Of course, eating exceptions is terribly bad. Yes, raising exceptions because user input is bad is a long stretch.
> Hi Kevin, > > Try-Catch blocks are an absolute necessity as without them, you are > putting the operation of your software into the hands of user input > errors, http errors, unintended consequences as well as the myriad of > things that exist outside the "Happy Path". > > I respectfully disagree. IMHO, try-catch is only useful in rare > situations; like file IO in an Air app. User input should be handled > with restict and validators and http errors should be handled with a > fault handler. What I'm saying is that well written/tested code > rarely needs the overhead and verboseness of a try-catch block. In > the event of un-caught errors, I personally want the Flash window to > popup. While the dialog could be more elegant, the stack trace makes > it easier to locate the problem and fix the bug quickly. Again, just > my opinion. > > -TH > > --- In [email protected], "Kevin Benz" <kb...@...> wrote: > > > > Try-Catch blocks are an absolute necessity as without them, you are > > putting the operation of your software into the hands of user input > > errors, http errors, unintended consequences as well as the myriad of > > things that exist outside the "Happy Path". As functions/methods only > > give you one return object, it is common practice to throw custom > > errors/exceptions as they are a great mechanism for handling dynamic > > environments. > > > > > > > > To answer your second question about a try-catch without statements in > > the catch block. If this method is nested inside of another try-catch > > block, then an exception here will be swallowed and not be caught in the > > calling objects try-catch. > > > > > > > > KFB > > > > > > > > From: [email protected] [mailto:[email protected]] On > > Behalf Of SJF > > Sent: Tuesday, March 03, 2009 6:54 PM > > To: flexcoders > > Subject: [flexcoders] try, catch, finally ... > > > > > > > > Technically, it's good practice/professional to use try-catch-finally > > blocks in your actionscript logic. This ensures a robust, easily > > debugg-able application. > > > > However, can anyone comment if they actually use try-catch-finally or > > whether anyone is for or against it's use. > > > > I ask because I've received an application (which streams vidoe) that > > was blowing out numerous users CPUs to 100%. Upon further investigation, > > it appears that a netstream event is firing 20 times a second, and > > within the listener (listener function that is) for the event, there is > > a try-catch-finally block. I removed the try-catch-finally and CPU usage > > halved on my machine. > > > > Anyone care to comment for or against try-catch-finally and it's use. > > > > > > > > Steve. > > > > > > > > > > -- > > This message has been scanned for viruses and > > dangerous content by MailScanner <http://www.mailscanner.info/> , and is > > > > believed to be clean. > > > >

