Re: [RFC][DISCUSSION] - Throwables error code's type generalization

From: Date: Sun, 18 Dec 2016 13:09:27 +0000
Subject: Re: [RFC][DISCUSSION] - Throwables error code's type generalization
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-97440@lists.php.net to get a copy of this message
2016-12-18 10:38 GMT+01:00 Wes <netmo.php@gmail.com>: > Good morning nice internals PHPeople, > > I have just written a new RFC. I believe is mostly about cosmetic changes, > as what is being proposed is probably already informally supported by PHP. > > I would like your opinion about it: > https://wiki.php.net/rfc/throwable-code-generalization > > Thank you. > +1 from my side. Currently exception codes hardly see any use. Nobody wants to invent some codes that have to be documented and are hard to remember. Instead, most people just extend their exceptions to subclasses. But what if the code comes from external software? It's fine for MySQL, because MySQL provides numeric error codes. But a lot of software is now talking to remove APIs. To my experience, most of them use non-numeric error codes, simply because they're human-readable. I don't think we should allow objects there, objects are hardly codes. But allowing string|int would be great for usage with many APIs and make $code actually useful again.

« previous php.internals (#97440) next »