[VOTE] Use exceptions by default in SQLite3 extension

php.internals

BohwaZ/PHP

3 years ago
Voting has now started for the RFC "Use exceptions by default in SQLite3 extension": https://wiki.php.net/rfc/sqlite3_exceptions The vote is open for 2 weeks. Thanks to the people who wrote the RFC howto page :) BohwaZ

Илья Сомов

3 years ago
Hi! It says in the RFC:
> PDO is using exceptions, like everyone else.
and
> Create a new exception class SQLite3Exception, which extends the Exception class
The `PDOException` class is actually extending the `RuntimeException`, not just `Exception`. I am sure it is better to do this for `SQLite3Exception` as well. Regards, Illia / someniatko

BohwaZ/PHP

3 years ago
Hi Illia, thank you for your feedback. This is actually what I did, first, but I changed after feedback from @Girgias: https://github.com/php/php-src/pull/11058#discussion_r1162723112
> You are likely to get push back not just from myself if you propose > it as such in an RFC
I don't have a strong opinion one way or another. I just felt it was more coherent (with PDO) to use RuntimeException.

Girgias

3 years ago
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

Илья Сомов

3 years ago
Got it, thank you for explaining. Regards, Illia / someniatko

BohwaZ/PHP

3 years ago
Voting has now ended with 21 votes for the "yes", and zero votes for the "no". Thanks everyone!