I created an exception :
public class PkDeleteException extends java.lang.Exception {
private static final long serialVersionUID = 1L;
public PkDeleteException(String msg) {
super(msg);
}
}
Now I threw it in the catch block of some code :
import com.ambre.pta.utils.PkDeleteException;
public class AdminRole {
@Autowired
private Environment env;
@Autowired
private RoleDAO roleDao;
public void del(@RequestParam String id) {
try {
roleDao.delete(id);
} catch (org.hibernate.exception.ConstraintViolationException e) {
Role role = roleDao.get(id);
String errMsg = env.getProperty("admin.list.profils.err.suppr");
errMsg = errMsg.replace("%s", role.getRole_lib());
throw new PkDeleteException(errMsg);
}
}
}
But I got an error Unhandled exception type PkDeleteException
!
There are suggested solutions proposed by Eclipse but I do not want to follow them ! So why is there this error ?