我有一个自定义异常类写为
public class MyCustomException extends RuntimeException {
public MyCustomException(Throwable cause) {
super(cause);
}
enter code here
/**
* @param message
* @param cause
*/
public MyCustomException(String message, Throwable cause) {
super(message, cause);
}
}
Run Code Online (Sandbox Code Playgroud)
在我的serviceImpl层
@Override
public List<SiteDetails> getSite() throws MyCustomException {
}
Run Code Online (Sandbox Code Playgroud)
SONAR(用于 linting 的 Ecplise IDE 插件)指出:
删除抛出异常“.MyCustomException”的声明,这是一个运行时异常
我应该删除声明还是应该Exception在MyCustomException类中扩展而不是RunTimeException?