I'm struggling with a very simple question:
I'm now working on a server application, and I need to invent a hierarchy for the exceptions (some exceptions already exist, but a general framework is needed). How do I even start doing this?
I'm thinking of following this strategy:
1) What is going wrong?
- Something is asked, which is not allowed.
- Something is asked, it is allowed, but it does not work, due to wrong parameters.
- Something is asked, it is allowed, but it does not work, because of internal errors.
2) Who is launching the request?
- The client application
- Another server application
3) Message handing : as we are dealing with a server application, it's all about receiving and sending messages. So what if the sending of a message goes wrong?
As such, we might get following exception types:
- ServerNotAllowedException
- ClientNotAllowedException
- ServerParameterException
- ClientParameterException
- InternalException (in case the server does not know where the request is coming from)
- ServerInternalException
- ClientInternalException
- MessageHandlingException
This is a very general approach to define exception hierarchy, but I'm afraid that I might be lacking some obvious cases. Do you have ideas on which areas I'm not covering, are you aware of any drawbacks of this method or is there a more general approach to this kind of question (in the latter case, where can I find it)?
Thanks in advance