Hi Berin, Thanks for your analysis, I fully agree with your conclusions.
...You have a much better idea of the problem when you see ValidatorInitializationException as opposed to RuntimeException...
Yes, and it's so cheap to do, there's really no reason not to do it. But your report shows that we have a lot of work to do to fix our code...
About exceptions, two patterns that I use frequently in my projects are
a) Inner exception in service interface
public interface MarsExplorerService {
static public class RobotFailedException extends
WhateverBaseExceptionYouLike {
...
}
}
Which gives you a MarsExplorerService.RobotFailedException - the name
says a lot already.
b) Exception marker interfacesclass RemoteWebServiceUnavailableException extends WhateverBaseExceptionYouLike
implements NetworkRelatedProblem, UserCanRetryLater
Where the interfaces can be used to classify the exceptions in error
reporting, for example here to tell the user that they should retry the
operation later with a reasonable chance of success.
Most often the interfaces here are markers only, they have no methods, but in some case methods can be useful to give additional information.
-Bertrand
smime.p7s
Description: S/MIME cryptographic signature
