diff --git a/src/cli/backup/exchange.go b/src/cli/backup/exchange.go index 1d779b0ad..9640bae45 100644 --- a/src/cli/backup/exchange.go +++ b/src/cli/backup/exchange.go @@ -388,7 +388,7 @@ func detailsExchangeCmd(cmd *cobra.Command, args []string) error { ds := sel.Reduce(ctx, d) if len(ds.Entries) == 0 { - Info(ctx, "nothing to display: no items in the backup match the provided selectors") + Info(ctx, selectors.ErrorNoMatchingItems) return nil } diff --git a/src/internal/operations/restore.go b/src/internal/operations/restore.go index ff6bc8ccb..069d46448 100644 --- a/src/internal/operations/restore.go +++ b/src/internal/operations/restore.go @@ -134,7 +134,7 @@ func (op *RestoreOperation) Run(ctx context.Context) (err error) { // format the details and retrieve the items from kopia fds = er.Reduce(ctx, d) if len(fds.Entries) == 0 { - return errors.New("nothing to restore: no items in the backup match the provided selectors") + return selectors.ErrorNoMatchingItems } case selectors.ServiceOneDrive: diff --git a/src/pkg/selectors/selectors.go b/src/pkg/selectors/selectors.go index bc88608c8..88bca941f 100644 --- a/src/pkg/selectors/selectors.go +++ b/src/pkg/selectors/selectors.go @@ -21,7 +21,10 @@ const ( ServiceOneDrive // OneDrive ) -var ErrorBadSelectorCast = errors.New("wrong selector service type") +var ( + ErrorBadSelectorCast = errors.New("wrong selector service type") + ErrorNoMatchingItems = errors.New("no items match the specified selectors") +) const ( scopeKeyCategory = "category"