Re: Error handling brainstorming

From: Date: Mon, 06 Aug 2012 18:44:15 +0000
Subject: Re: Error handling brainstorming
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-62068@lists.php.net to get a copy of this message
Hi! > but sometimes you want to be more precise. With exceptions, we have an > elegant way to manage all failures as a whole, or to differenciate each > reason. You do not, unless you have 20 exception types and catch them all separately. Which nobody would ever do for one simple reason - what if you miss one? What if next version adds one and you didn't update your code? In practice what happens is people just write try { ...} catch(Exception e) {} and that's it. > "protected call" function [1]. A convenient mean to say «OK, I know this > expression may raise an exception, but I don't care, discard it silently > please. I will check if my variable has been set or not.». > > [1] : http://www.lua.org/pil/8.4.html Which, coincidentally, is exactly like PHP works. I see no reason to rewrite all the functions just to add the functions that allow you to go back. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227

« previous php.internals (#62068) next »