Should a method (remote method call) return a boolean true value indicating that an operation performed successfully even if all possible exceptions are thrown?
Example:
In my java application have many CRUD remote method calls and I catch all possible Exceptions and throw a Custom Exception to the calling client.
Should I now return void or a boolean, since the Exceptions already implicitly indicate the success or failure of the operation?
Return
void, not abooleanin this case.Exceptions are for exceptional conditions. Why indicating something like the success or failure of an operation on two different channels? The DRY principle teaches us:
I would only use a boolean to indicate further information, like it is sometimes done on collections, reporting whether an item was found for removal.