I have the following situation.
I have a Java Class that inherits from another base class and overrides a method. The base method does not throw exceptions and thus has no throws ... declaration.
Now my own method should be able to throw exception but I have the choices to either
- Swallow the exception or
- Add a throws declaration
Both a not satisfying because the first one would silently ignore the exception (ok I could perform some logging) and the second would generate compiler errors because of the different method headers.
public class ChildClass extends BaseClass { @Override public void SomeMethod() { throw new Exception("Something went wrong"); } }