Re: Error handling brainstorming

From: Date: Mon, 06 Aug 2012 04:33:30 +0000
Subject: Re: Error handling brainstorming
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-62060@lists.php.net to get a copy of this message
> . . .For example, if you try to > open a file and the file isn't there, throwing exception is a very > annoying behavior (yes I know some languages do that, IMO it's wrong). Because checking that the returned variable is !== FALSE is *way* better than throwing an exception, right? This type of thing is one of the main reasons I like PDO more than MySQLi. In MySQLi I'm constantly checking return values. In PDO I just wrap it all up one try/catch. It's not like if my query fails I'm going to try a different one. Most of the time it's just logging that something went wrong and reporting it upstream somehow. I understand that opening a file is a bit different than querying a database, but I have to disagree with your entire previous post. Exceptions are much nicer than errors. Of course, everyone is entitled to have and express their own opinion. I'm just sharing mine.

« previous php.internals (#62060) next »