Wrap errors for storage backend creation.

This commit is contained in:
MaxJa4 2023-08-21 14:42:19 +02:00
parent c5d596d78b
commit ddca5c4853

View File

@ -158,7 +158,7 @@ func newScript() (*script, error) {
PartSize: s.c.AwsPartSize, PartSize: s.c.AwsPartSize,
} }
if s3Backend, err := s3.NewStorageBackend(s3Config, logFunc); err != nil { 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 { } else {
s.storages = append(s.storages, s3Backend) s.storages = append(s.storages, s3Backend)
} }
@ -173,7 +173,7 @@ func newScript() (*script, error) {
RemotePath: s.c.WebdavPath, RemotePath: s.c.WebdavPath,
} }
if webdavBackend, err := webdav.NewStorageBackend(webDavConfig, logFunc); err != nil { 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 { } else {
s.storages = append(s.storages, webdavBackend) s.storages = append(s.storages, webdavBackend)
} }
@ -190,7 +190,7 @@ func newScript() (*script, error) {
RemotePath: s.c.SSHRemotePath, RemotePath: s.c.SSHRemotePath,
} }
if sshBackend, err := ssh.NewStorageBackend(sshConfig, logFunc); err != nil { 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 { } else {
s.storages = append(s.storages, sshBackend) s.storages = append(s.storages, sshBackend)
} }
@ -215,7 +215,7 @@ func newScript() (*script, error) {
} }
azureBackend, err := azure.NewStorageBackend(azureConfig, logFunc) azureBackend, err := azure.NewStorageBackend(azureConfig, logFunc)
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("newScript: error creating azure storage backend: %w", err)
} }
s.storages = append(s.storages, azureBackend) s.storages = append(s.storages, azureBackend)
} }
@ -228,7 +228,7 @@ func newScript() (*script, error) {
} }
dropboxBackend, err := dropbox.NewStorageBackend(dropboxConfig, logFunc) dropboxBackend, err := dropbox.NewStorageBackend(dropboxConfig, logFunc)
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("newScript: error creating dropbox storage backend: %w", err)
} }
s.storages = append(s.storages, dropboxBackend) s.storages = append(s.storages, dropboxBackend)
} }