Hi,
I mightn't expressed myself correctly, maybe better if I will give some simple example.
Method readRecord(recordNumber) according to interface can throw exception RecordNotFoundException (checked exception) in case if record doesn't exist in database or is market as deleted.
That's fine but in process of reading data from database some unexpected error can occur - for example data format was incorrect, data length is wrong etc.
In this situation I have 2 options:
1) use allowed RecordNotFoundException with constructor containing parameter "String message" and set it to something descriptive like: "Unexpected error while reading record numer N".
2) add unchecked exception to my implementation of this method, for example MalformedRecordException
ant throw it
My choice was 1) because in this case I've guarantee that other developer who might use my implementation will have to catch it, while 2) is no guaranteeing this. But according to my instruction I should throw RecordNotFoundException if record is missing or is marked as deleted.
I'm not sure if I've choose right option - hope you will share you ideas related with this problem
-------------------------------------------------------------------------------------------------------------------------
Regards,
Adam.