use of org.rstudio.studio.client.workbench.views.files.model.PendingFileUpload in project rstudio by rstudio.
the class FileUploadDialog method parseResults.
@Override
protected PendingFileUpload parseResults(String results) throws Exception {
RpcResponse response = RpcResponse.parse(results);
if (response == null)
throw new Exception("Unexpected response from server");
// check for errors
RpcError error = response.getError();
if (error != null) {
// select a directory
if (error.getCode() == RpcError.PARAM_INVALID && fileUpload_.getFilename().length() == 0) {
throw new Exception("You must specify a file to upload.");
} else {
throw new Exception(error.getEndUserMessage());
}
}
// return PendingFileUpload
PendingFileUpload pendingFileUpload = response.getResult();
return pendingFileUpload;
}
Aggregations