Re: error handling in pecl extensions (was Re: intl/resourcebundle)
| From: | Derick Rethans | Date: | Sun, 20 Dec 2009 15:25:41 +0000 |
| Subject: | Re: error handling in pecl extensions (was Re: intl/resourcebundle) | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-6932@lists.php.net to get a copy of this message | ||
On Sun, 20 Dec 2009, Hans-Peter Oeri wrote:
> As stas pointed out to me, intl does not use exceptions for error
> handling. As a matter of fact, there seems to be a completely separate
> "error handling" within intl.
Yes, unfortunately :/
> Unfortunately, I didn't find any "best practices" or "agreements" on
> how
> error conditions in pecl extensions should be handled. For me - in my
> newbie ignorance -, using neither extensions nor the classic error
> handling seems illogical. It forces the user to recreate specific error
> handling - as it does not use the "available" tools.
>
> Is there any documentation that would help me understand that decision?
Not that I know of, but there are a few things that should be kept in
mind:
- Nothing internally in PHP throws exceptions by default
- Functions should not throw notices and warnings at random, but instead
should return their status, in combination with functions to retrieve
more elaborate error messages/statusses.
- Constructors should throw exceptions, because there is no other way of
returning error information.
> Was there any discussion on allowing classic php_errors and/or
> exceptions by ini configuration?
>
> Would there probably be a need for a inter-extension ini indicating to
> extensions, if php_errors and/or exceptions are wanted by the user?
We've discussed this before I think—the general idea is that we
definitely do *not* want INI settings that change this sort of behavior
as they remove control over error reporting/handling from the
developers. The PDO extension allows as an option to the objects to use
a specific kind of error handling.
regards,
Derick
--
http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org
twitter: @derickr