PHP exception naming and error codes best practices? -
what's piece of advice on exception naming these days ?
- standard (java-style, old?) convention keep them @ root of namespace exception suffix:
example\project\configurationexception
- symfony splits them purpose/components (source):
example\project\user\banneduserexception
example\project\graphs\notenoughdataexception
- facebook store them , keep exception suffix classes:
facebook\exceptions\facebooksdkexception.php
(source) - braintree keep exceptions inside exception folder:
braintree\exception\notfound
(source) - stripe has ditched entirely word exception in sdk , keep them inside same folder:
stripe\error\invalidrequest
. (source)
there seems as ways there's developers out there... there written convention or what's trend out there used of ?
also, set error code part of exceptions ? if so, how manage code ?
i've got bunch of constants in example\project\errors
, braintree does.
Comments
Post a Comment