Re: [RFC] Throwable Hierarchy Policy for Extensions

From: Date: Wed, 30 Apr 2025 20:56:38 +0000
Subject: Re: [RFC] Throwable Hierarchy Policy for Extensions
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Wed, 30 Apr 2025 at 21:13, Larry Garfield <[email protected]> wrote:
> >> […] just that it's the only time I've seen $code used in the wild...
> >>
> >
> > PDO (for better or worse) also uses the $code for the error code
> > returned by the database. Unfortunately it also widens the (untyped)
> > $code from int to string|int, which causes some issues, since folks only
> > expect int, since Exception::__construct() types the $code parameter
> > as int.
> >
> > Best regards
> > Tim Düsterhus
>
> In my experience, worse.  But that's another topic.


PDO is a bad example because the code is pretty much useless. You need
to get the actual code from errorInfo[1] if you want to know the
reason.


Thread (19 messages)

« previous php.internals (#127258) next »