From 2229437a7faab32218117c1cf5c0dea32145d284 Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Tue, 7 Nov 2023 13:40:18 -0800 Subject: [PATCH] Include original error when restic command fails --- restic.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/restic.go b/restic.go index cfcbf4d..7c295e8 100644 --- a/restic.go +++ b/restic.go @@ -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