Re: [VOTE] Use exceptions by default in SQLite3 extension
| From: | G. P. B. | Date: | Mon, 15 May 2023 16:02:16 +0000 |
| Subject: | Re: [VOTE] Use exceptions by default in SQLite3 extension | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120287@lists.php.net to get a copy of this message | ||
On Mon, 15 May 2023 at 15:41, someniatko <someniatko@gmail.com> wrote:
> The
PDOException class is actually extending the
> RuntimeException,
> not just Exception.
>
Yes, and this is, IMHO, a mistake.
Outside SPL, there are only 4 extensions which extend from RuntimeException:
- PDO
- MySQLi
- SNMP
- Phar
See:
https://heap.space/search?project=php-src&full=&defs=&refs=spl_ce_RuntimeException&path=&hist=&type=
The vast majority of extensions that define their own custom exceptions
extend Exceptions.
The reason being that depending on a separate extension (here SPL) instead
of core API is less than ideal.
Moreover, SPL exceptions are meant for userland.
And I personally find it extremely strange that if I attempt to catch a
RuntimeException I might as well catch a PDO failure.
Best regards,
George P. Banyard