I am facing the following problem :
-
I have a namespace
Exception\*,
which contains several types of
exceptions. -
I have a namespace
Exception\User\*, which contains a
specific kind of exceptions
(Forbidden,LoggedOut…).
Where do I put the User base exception class, extended by Forbidden and LoggedOut :
Exception\User, i.e. in theException\*namespace (better full name) ?Exception\User\User, i.e. in theException\User\*namespace (more consistent) ?Exception\User\Exception, i.e. I rename it to be the “base” exception of theException\User\*namespace (weird) ?
NB : the User exception class is not abstract.
Precision : I’ve used an example with exceptions, this is just an example. I am really wondering about where to put/how to name a base class in a namespace tree.
Thanks if you can help me !
1 Answer