Search in sources :

Example 1 with PendingFileUpload

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;
}
Also used : PendingFileUpload(org.rstudio.studio.client.workbench.views.files.model.PendingFileUpload) RpcError(org.rstudio.core.client.jsonrpc.RpcError) RpcResponse(org.rstudio.core.client.jsonrpc.RpcResponse)

Aggregations

RpcError (org.rstudio.core.client.jsonrpc.RpcError)1 RpcResponse (org.rstudio.core.client.jsonrpc.RpcResponse)1 PendingFileUpload (org.rstudio.studio.client.workbench.views.files.model.PendingFileUpload)1