lundi 2 mars 2015

Testing generic errors


I've got a program that validates it's input, and then errors.


So far for each kind of error I created a new derived class. But this was getting pretty unwieldy (the input is complex so there are many possible errors) so instead I made the base more flexible and removed all the derived classes.


The core resulting issue is that now when I test with certain invalid inputs, I'm not sure how to identify the "correct" error anymore. If the program produces an error on invalid input but it's the wrong one, how am I going to identify the correct error without effectively hardcoding internal error implementation details?


Edit: I also intended to specify that the reason I went with a new derived class per error type is that I need dynamically extensible error types. Something like an enumeration would never be suitable.





Aucun commentaire:

Enregistrer un commentaire