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
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
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.
The
PDOExceptionclass is actually extending theRuntimeException, not justException.
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