simplifying raiseError
| From: | Stig S. Bakken | Date: | Sun, 07 Jul 2002 22:07:07 +0000 |
| Subject: | simplifying raiseError | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-7538@lists.php.net to get a copy of this message | ||
Hi,
Now that I'm in the process of adding ZE2 and exception support to
PEAR.php, it made me want to simplify the raiseError method a bit. It
carries around a lot of baggage from when "return new PEAR_Error" was
used, and before. The parameter order is the most visible proof of
this, the fact that you are able to override mode and options in the
raise call is another.
IMHO, libraries have as much business setting error modes and options as
they have setting php.ini options, that is: none, except in very rare
cases. The application knows best how it wants to deal with
errors/exceptions that are not caught.
If you sympathize with this view, you may very well agree that having
"userinfo" as the fifth parameter, with two "dead" ones (mode and
options) that you have to set to null between, is cumbersome. So I'd
like to introduce a new method for raising errors with only three
parameters: error message, error code and userinfo. Some of the
original idea behind having error codes was to make I18N easier. In
practice it's not, so while I'm at it I'd like to get everyone's input
on how to integrate I18N better in the new error raising method.
- Stig
--
Stig Sæther Bakken, Fast Search & Transfer ASA, Trondheim, Norway
http://pear.php.net/wishlist.php/ssb