mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-22 21:30:28 +01:00
Frederik Ring
b60c747448
* Simplify logging, fix WebDAV spelling * Define options types per package * Move util functions that are not used cross package * Add per file license headers * Rename config type
25 lines
461 B
Go
25 lines
461 B
Go
// Copyright 2022 - Offen Authors <hioffen@posteo.de>
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package utilities
|
|
|
|
import (
|
|
"errors"
|
|
"strings"
|
|
)
|
|
|
|
// Join takes a list of errors and joins them into a single error
|
|
func Join(errs ...error) error {
|
|
if len(errs) == 1 {
|
|
return errs[0]
|
|
}
|
|
var msgs []string
|
|
for _, err := range errs {
|
|
if err == nil {
|
|
continue
|
|
}
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return errors.New("[" + strings.Join(msgs, ", ") + "]")
|
|
}
|