backup: Improve error message for invalid pattern

This commit is contained in:
Alexander Neumann
2018-10-03 11:12:51 +02:00
parent 33dfbf5c38
commit fb31d66951
2 changed files with 6 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import (
"bufio"
"bytes"
"context"
"fmt"
"io/ioutil"
"os"
"path/filepath"
@@ -308,7 +309,7 @@ func collectTargets(opts BackupOptions, args []string) (targets []string, err er
var expanded []string
expanded, err := filepath.Glob(line)
if err != nil {
return nil, err
return nil, errors.WithMessage(err, fmt.Sprintf("pattern: %s", line))
}
lines = append(lines, expanded...)
}