News for hackers. Stuff that matters.
Re:Don’t Use Try/Catch (2010) by deathanatos on Saturday December 28, 2013 @12:54PM (#6975568)
Not only are the points you raise valid, but I feel the webapp example exemplifies the strengths of exceptions: That the default behavior is to propagate to a context that can deal with the exception, and that you can catch them all at strategic points, like the main request handler of a webserver. You're not "crashing the thread" like the article implies: you're purposefully catching some error you didn't expect (bugs happen), logging/capturing it for debugging (perhaps even with a traceback), and gracefully returning at worst a 500 to the current request, all the while continuing to serve further requests.

It's been best practice for quite some time not to catch { // heh heh he. }.

There are no comments on this comment yet.