# [VOTE] Use exceptions by default in SQLite3  extension

- Thread: https://externals.io/message/120214
- Original archive: https://news-web.php.net/php.internals/120214
- Started by BohwaZ on 2023-05-08T22:03:25+00:00
- Messages: 6
- RFC: Throwable Hierarchy Policy for Extensions (Accepted) — https://externals.io/rfc/extension_exceptions.md
- RFC: Use exceptions by default in SQLite3 extension (Implemented (PHP 8.3)) — https://externals.io/rfc/sqlite3_exceptions.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #120214 — BohwaZ — 2023-05-08T22:03:25+00:00

URL: https://externals.io/message/120214#120214

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

---

## #120284 — someniatko — 2023-05-15T14:41:02+00:00

URL: https://externals.io/message/120214#120284 · In reply to: #120214

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

---

## #120286 — BohwaZ — 2023-05-15T15:05:31+00:00

URL: https://externals.io/message/120214#120286 · In reply to: #120284

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.

---

## #120287 — G. P. B. — 2023-05-15T16:02:16+00:00

URL: https://externals.io/message/120214#120287 · In reply to: #120284

> 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

---

## #120288 — someniatko — 2023-05-15T16:53:13+00:00

URL: https://externals.io/message/120214#120288 · In reply to: #120287

Got it, thank you for explaining.

Regards,
Illia / someniatko

---

## #120392 — BohwaZ — 2023-05-23T20:20:25+00:00

URL: https://externals.io/message/120214#120392 · In reply to: #120214

Voting has now ended with 21 votes for the "yes", and zero votes for
the "no".

Thanks everyone!
