From ddca5c48538ed48b01506b7429037724c3f54531 Mon Sep 17 00:00:00 2001 From: MaxJa4 <74194322+MaxJa4@users.noreply.github.com> Date: Mon, 21 Aug 2023 14:42:19 +0200 Subject: [PATCH] Wrap errors for storage backend creation. --- cmd/backup/script.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/backup/script.go b/cmd/backup/script.go index fc48449..2fca193 100644 --- a/cmd/backup/script.go +++ b/cmd/backup/script.go @@ -158,7 +158,7 @@ func newScript() (*script, error) { PartSize: s.c.AwsPartSize, } if s3Backend, err := s3.NewStorageBackend(s3Config, logFunc); err != nil { - return nil, err + return nil, fmt.Errorf("newScript: error creating s3 storage backend: %w", err) } else { s.storages = append(s.storages, s3Backend) } @@ -173,7 +173,7 @@ func newScript() (*script, error) { RemotePath: s.c.WebdavPath, } if webdavBackend, err := webdav.NewStorageBackend(webDavConfig, logFunc); err != nil { - return nil, err + return nil, fmt.Errorf("newScript: error creating webdav storage backend: %w", err) } else { s.storages = append(s.storages, webdavBackend) } @@ -190,7 +190,7 @@ func newScript() (*script, error) { RemotePath: s.c.SSHRemotePath, } if sshBackend, err := ssh.NewStorageBackend(sshConfig, logFunc); err != nil { - return nil, err + return nil, fmt.Errorf("newScript: error creating ssh storage backend: %w", err) } else { s.storages = append(s.storages, sshBackend) } @@ -215,7 +215,7 @@ func newScript() (*script, error) { } azureBackend, err := azure.NewStorageBackend(azureConfig, logFunc) if err != nil { - return nil, err + return nil, fmt.Errorf("newScript: error creating azure storage backend: %w", err) } s.storages = append(s.storages, azureBackend) } @@ -228,7 +228,7 @@ func newScript() (*script, error) { } dropboxBackend, err := dropbox.NewStorageBackend(dropboxConfig, logFunc) if err != nil { - return nil, err + return nil, fmt.Errorf("newScript: error creating dropbox storage backend: %w", err) } s.storages = append(s.storages, dropboxBackend) }