2016-12-18 10:38 GMT+01:00 Wes <netmo....@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.