Include original error when restic command fails

This commit is contained in:
IamTheFij 2023-11-07 13:40:18 -08:00
parent 4b16dea34e
commit 2229437a7f

View File

@ -13,7 +13,7 @@ import (
var (
ErrRestic = errors.New("restic error")
ErrRepoNotFound = errors.New("repository not found or uninitialized")
ErrRepoNotFound = errors.Join(errors.New("repository not found or uninitialized"), ErrRestic)
)
func lineIn(needle string, haystack []string) bool {
@ -315,7 +315,7 @@ func (rcmd Restic) RunRestic(
responseErr = ErrRepoNotFound
}
return output, NewResticError(command, output.AllLines(), responseErr)
return output, NewResticError(command, output.AllLines(), errors.Join(err, responseErr))
}
return output, nil