What's your piece of advice on exception naming these days ?
Example\Project\ConfigurationExceptionExample\Project\User\BannedUserExceptionExample\Project\Graphs\NotEnoughDataExceptionFacebook\Exceptions\FacebookSDKException.php (source)Braintree\Exception\NotFound (source)Stripe\Error\InvalidRequest. (source)There seems to be as much as ways as there's developers out there... but is there a written convention or what's the trend out there used by the most of us ?
Also, do you always set an error code as part of your exceptions ? If so, how do you manage those code ?
I've got a bunch of constants in Example\Project\Errors, just like Braintree does.
Well, I think the Exception part it's a thing that everyone do in a different way, and for me the Symfony way make it more sense, but depend on you project if it's little and you may have a few exceptions, it's okey i think to store inside an Exception folder, but i prefer to store in a folder and if necessary make it subfolders, and all the clases extends de \Extension for the PHP and if necessary another class of your own.
For the moment I'm not so experienced with the exception thing, because you need to catch and process them, with a try cath or with a listener, but i think it's a nice thing to have in present!
Jan Vladimir Mostert
Idea Incubator
For large Java projects, the convention is to have an exception package containing all the exception classes, have a look at the Camunda Source Code