Code: Select all
public String[] getDataForUser(String userid) throws ServerException{
try{
String dbdata = loadFromDB(userid);
String filedata = loadFromFile(userid);
return new String[]{dbdata, filedata};
}catch(SQLException|IOException se){
ServerException e = new ServerException("Unable to load data");
e.setCause(se);
}
return null;
}
Please note that the method declares "throws ServerException"!
So how can this be "a good approach to exception handing..." like the (correct) answer 1 says?
Is it possible that there is a
Code: Select all
throw e;