"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
rc: return error from remote on failure
Nick Craig-Wood3d8e529441a9
diff --git a/cmd/rc/rc.go b/cmd/rc/rc.goindex 73f9a49b9..cdfec97af 100644--- a/cmd/rc/rc.go+++ b/cmd/rc/rc.go@@ -4,6 +4,7 @@ import ("bytes""encoding/json""fmt"+ "io/ioutil""net/http""os""strings"@@ -39,7 +40,7 @@ Arguments should be passed in as parameter=value.The result will be returned as a JSON object by default.-Use "rclone rc list" to see a list of all possible commands.`,+Use "rclone rc" to see a list of all possible commands.`,Run: func(command *cobra.Command, args []string) {cmd.CheckArgs(0, 1E9, command, args)cmd.Run(false, false, command, func() error {@@ -80,6 +81,19 @@ func doCall(path string, in rc.Params) (out rc.Params, err error) {}defer fs.CheckClose(resp.Body, &err)+ if resp.StatusCode != http.StatusOK {+ var body []byte+ body, err = ioutil.ReadAll(resp.Body)+ var bodyString string+ if err == nil {+ bodyString = string(body)+ } else {+ bodyString = err.Error()+ }+ bodyString = strings.TrimSpace(bodyString)+ return nil, errors.Errorf("Failed to read rc response: %s: %s", resp.Status, bodyString)+ }+// Parse outputout = make(rc.Params)err = json.NewDecoder(resp.Body).Decode(&out)