On Wed, 30 Apr 2025 at 21:13, Larry Garfield <la...@garfieldtech.com> 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.

Reply via email to