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
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php