improve language on selector reduce error (#794)

## Description

shorten and consolidate the error message when
the provided selectors match zero entries in the
backup entity list.

## Type of change

- [x] 🐹 Trivial/Minor

## Issue(s)

* #564

## Test Plan

- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
Keepers 2022-09-22 09:44:08 -06:00 committed by GitHub
parent d633be9eef
commit 76f2c5a632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -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
}

View File

@ -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:

View File

@ -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"