Suppose you are dealing with a situation where you need to handle lot of errorcodes from different server, what would be the design pattern to apply?
- Suppose 400 is errorcode, sometimes errormessage can vary. For example, a) 400:Cannot handle , b) 400:Unknown User.
- I have currently created an enum, which lists all the error codes in one place, with its unique error message. So that, this enum could be used to map to a handler.
- My specific doubt is how to create handler class, what design pattern to apply here. Basically my objective is to write some beautiful code, which could be reused, in case of future, different error codes appear from the server.
Is there any open source code example, which I can refer to, handling similar scenario.
Aucun commentaire:
Enregistrer un commentaire