IllegalArgumentException vs a check exception
so, i thought about what i'm doing for Issue 9 in the SensorProperties class. i'm throwing a checked exception when the sensor properties file is invalid (missing, not readable, etc). so, why i don't i throw a unchecked IllegalArgumentException? Hm... I think thats because, this error should be handled by the clients. see this little article (i looked it up to make sure i was right).
In our case, all the client should do is report to the user that the SensorProperties is invalid and to configure it. In my mind that is a useful recovery action. Moreover, in some ways it forces the clients to check and report problems with the configuration.
so, to conclude, i think this is my justification for doing the way i'm doing it. any problems with that?
No comments:
Post a Comment