Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:6814 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33420 invoked by uid 1010); 6 Jan 2004 05:05:01 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 33396 invoked by uid 1007); 6 Jan 2004 05:05:00 -0000 Message-ID: <20040106050500.33395.qmail@pb1.pair.com> To: internals@lists.php.net Date: Tue, 06 Jan 2004 00:04:59 -0500 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 66.65.38.153 Subject: Exception class feature request From: cellog@php.net (Greg Beaver) Hi, I think my first attempt may have bounced, so I'm resending this. I wonder if it would be a difficult thing to add in a third optional parameter to the constructor for Exception, which would accept an array of error-specific information. I find that many errors I use have information embedded in the message which it would be nice to have in certain instances, such as when an error is triggered by an external entity and contains more information than just an error code. $ex = new Exception('database error, dsn ' . $dsn, DATA_ERROR_CODE, array('dsn' => $dsn, 'mysql_message' => $errmsg, 'mysql_code' => $errcode)); I know that I can just append this after constructing the exception like so: $ex->data = array('dsn' => $dsn, 'mysql_message' => $errmsg, 'mysql_code' => $errcode)); or extend the Exception class to be OO pretty, but it would be nice to have such a thing standardized, as we can then count on the error data existing in a standard way across all apps that use PHP 5 Exceptions. I realize this would be in 5.1, most likely, if it is implemented. Thanks, Greg