Fixup references to sentinel error
This commit is contained in:
parent
d2253145bf
commit
0ce35f4f62
@ -12,8 +12,8 @@ import (
|
||||
"github.com/alcionai/corso/src/cli/flags"
|
||||
. "github.com/alcionai/corso/src/cli/print"
|
||||
"github.com/alcionai/corso/src/cli/utils"
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/common/idname"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/m365/graph"
|
||||
"github.com/alcionai/corso/src/pkg/backup"
|
||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||
@ -307,7 +307,7 @@ func genericListCommand(
|
||||
if len(bID) > 0 {
|
||||
fe, b, errs := r.GetBackupErrors(ctx, bID)
|
||||
if errs.Failure() != nil {
|
||||
if errors.Is(errs.Failure(), data.ErrNotFound) {
|
||||
if errors.Is(errs.Failure(), errs.NotFound) {
|
||||
return Only(ctx, clues.New("No backup exists with the id "+bID))
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ func genericDetailsCore(
|
||||
d, _, errs := bg.GetBackupDetails(ctx, backupID)
|
||||
// TODO: log/track recoverable errors
|
||||
if errs.Failure() != nil {
|
||||
if errors.Is(errs.Failure(), data.ErrNotFound) {
|
||||
if errors.Is(errs.Failure(), errs.NotFound) {
|
||||
return nil, clues.New("no backup exists with the id " + backupID)
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ import (
|
||||
. "github.com/alcionai/corso/src/cli/print"
|
||||
"github.com/alcionai/corso/src/cli/utils"
|
||||
"github.com/alcionai/corso/src/internal/common/dttm"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/observe"
|
||||
"github.com/alcionai/corso/src/pkg/control"
|
||||
"github.com/alcionai/corso/src/pkg/export"
|
||||
@ -93,7 +93,7 @@ func runExport(
|
||||
|
||||
expColl, err := eo.Run(ctx)
|
||||
if err != nil {
|
||||
if errors.Is(err, data.ErrNotFound) {
|
||||
if errors.Is(err, errs.NotFound) {
|
||||
return Only(ctx, clues.New("Backup or backup details missing for id "+backupID))
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ import (
|
||||
"github.com/alcionai/corso/src/cli/flags"
|
||||
. "github.com/alcionai/corso/src/cli/print"
|
||||
"github.com/alcionai/corso/src/cli/utils"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/pkg/count"
|
||||
"github.com/alcionai/corso/src/pkg/selectors"
|
||||
)
|
||||
@ -114,7 +114,7 @@ func runRestore(
|
||||
|
||||
ds, err := ro.Run(ctx)
|
||||
if err != nil {
|
||||
if errors.Is(err, data.ErrNotFound) {
|
||||
if errors.Is(err, errs.NotFound) {
|
||||
return Only(ctx, clues.New("Backup or backup details missing for id "+flags.BackupIDFV))
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package data
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/pkg/control"
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
"github.com/alcionai/corso/src/pkg/path"
|
||||
@ -23,13 +24,13 @@ type FetchRestoreCollection struct {
|
||||
}
|
||||
|
||||
// NoFetchRestoreCollection is a wrapper for a Collection that returns
|
||||
// ErrNotFound for all Fetch calls.
|
||||
// errs.NotFound for all Fetch calls.
|
||||
type NoFetchRestoreCollection struct {
|
||||
Collection
|
||||
}
|
||||
|
||||
func (c NoFetchRestoreCollection) FetchItemByName(context.Context, string) (Item, error) {
|
||||
return nil, ErrNotFound
|
||||
return nil, errs.NotFound
|
||||
}
|
||||
|
||||
// StateOf lets us figure out the state of the collection from the
|
||||
|
||||
@ -9,6 +9,7 @@ import (
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/spatialcurrent/go-lazy/pkg/lazy"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/common/readers"
|
||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
@ -259,7 +260,7 @@ func (i *lazyItem) Info() (details.ItemInfo, error) {
|
||||
defer i.mu.Unlock()
|
||||
|
||||
if i.delInFlight {
|
||||
return details.ItemInfo{}, clues.Stack(ErrNotFound).WithClues(i.ctx)
|
||||
return details.ItemInfo{}, clues.Stack(errs.NotFound).WithClues(i.ctx)
|
||||
} else if i.info == nil {
|
||||
return details.ItemInfo{}, clues.New("requesting ItemInfo before data retrieval").
|
||||
WithClues(i.ctx)
|
||||
|
||||
@ -12,6 +12,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/common/readers"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
@ -376,7 +377,7 @@ func (suite *ItemUnitSuite) TestLazyItem_DeletedInFlight() {
|
||||
assert.Empty(t, readData, "read data")
|
||||
|
||||
_, err = item.Info()
|
||||
assert.ErrorIs(t, err, data.ErrNotFound, "Info() error")
|
||||
assert.ErrorIs(t, err, errs.NotFound, "Info() error")
|
||||
|
||||
e := errs.Errors()
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import (
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/common/readers"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||
@ -144,7 +145,7 @@ func (c Collection) FetchItemByName(
|
||||
) (data.Item, error) {
|
||||
res := c.AuxItems[name]
|
||||
if res == nil {
|
||||
return nil, data.ErrNotFound
|
||||
return nil, errs.NotFound
|
||||
}
|
||||
|
||||
return res, nil
|
||||
@ -163,7 +164,7 @@ func (rc RestoreCollection) FetchItemByName(
|
||||
) (data.Item, error) {
|
||||
res := rc.AuxItems[name]
|
||||
if res == nil {
|
||||
return nil, data.ErrNotFound
|
||||
return nil, errs.NotFound
|
||||
}
|
||||
|
||||
return res, nil
|
||||
|
||||
@ -10,7 +10,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/model"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/pkg/backup"
|
||||
@ -91,7 +91,7 @@ func (mg mockEmptyModelGetter) GetBackup(
|
||||
context.Context,
|
||||
model.StableID,
|
||||
) (*backup.Backup, error) {
|
||||
return nil, data.ErrNotFound
|
||||
return nil, errs.NotFound
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -269,7 +269,7 @@ func (mg mockModelGetter) GetBackup(
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
return nil, data.ErrNotFound
|
||||
return nil, errs.NotFound
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
"golang.org/x/exp/maps"
|
||||
"golang.org/x/exp/slices"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/model"
|
||||
"github.com/alcionai/corso/src/pkg/backup"
|
||||
"github.com/alcionai/corso/src/pkg/logger"
|
||||
@ -160,7 +160,7 @@ func cleanupOrphanedData(
|
||||
model.BackupSchema,
|
||||
bup.ModelStoreID,
|
||||
&bm); err != nil {
|
||||
if !errors.Is(err, data.ErrNotFound) {
|
||||
if !errors.Is(err, errs.NotFound) {
|
||||
return clues.Wrap(err, "getting backup model").
|
||||
With("search_backup_id", bup.ID)
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/model"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/pkg/backup"
|
||||
@ -116,7 +116,7 @@ func (ms mockStorer) GetWithModelStoreID(
|
||||
}
|
||||
}
|
||||
|
||||
return clues.Stack(data.ErrNotFound)
|
||||
return clues.Stack(errs.NotFound)
|
||||
}
|
||||
|
||||
func (ms mockStorer) DeleteWithModelStoreIDs(
|
||||
@ -518,11 +518,11 @@ func (suite *BackupCleanupUnitSuite) TestCleanupOrphanedData() {
|
||||
{bup: bupCurrent()},
|
||||
{
|
||||
bup: bupLegacy(),
|
||||
err: data.ErrNotFound,
|
||||
err: errs.NotFound,
|
||||
},
|
||||
{
|
||||
bup: bupNoDetails(),
|
||||
err: data.ErrNotFound,
|
||||
err: errs.NotFound,
|
||||
},
|
||||
},
|
||||
// Backup IDs are still included in here because they're added to the
|
||||
@ -623,7 +623,7 @@ func (suite *BackupCleanupUnitSuite) TestCleanupOrphanedData() {
|
||||
backups: []backupRes{
|
||||
{
|
||||
bup: backupWithTime(baseTime, bupCurrent()),
|
||||
err: data.ErrNotFound,
|
||||
err: errs.NotFound,
|
||||
},
|
||||
},
|
||||
time: baseTime,
|
||||
|
||||
@ -7,6 +7,7 @@ import (
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/kopia/kopia/fs"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/common/readers"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
@ -74,7 +75,7 @@ func (kdc kopiaDataCollection) FullPath() path.Path {
|
||||
}
|
||||
|
||||
// Fetch returns the file with the given name from the collection as a
|
||||
// data.Item. Returns a data.ErrNotFound error if the file isn't in the
|
||||
// data.Item. Returns a errs.NotFound error if the file isn't in the
|
||||
// collection.
|
||||
func (kdc kopiaDataCollection) FetchItemByName(
|
||||
ctx context.Context,
|
||||
@ -93,7 +94,7 @@ func (kdc kopiaDataCollection) FetchItemByName(
|
||||
e, err := kdc.dir.Child(ctx, encodeAsPath(name))
|
||||
if err != nil {
|
||||
if isErrEntryNotFound(err) {
|
||||
err = clues.Stack(data.ErrNotFound, err)
|
||||
err = clues.Stack(errs.NotFound, err)
|
||||
}
|
||||
|
||||
return nil, clues.Wrap(err, "getting item").WithClues(ctx)
|
||||
|
||||
@ -13,6 +13,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/common/readers"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
dataMock "github.com/alcionai/corso/src/internal/data/mock"
|
||||
@ -410,7 +411,7 @@ func (suite *KopiaDataCollectionUnitSuite) TestFetchItemByName() {
|
||||
|
||||
if err != nil {
|
||||
if test.notFoundErr {
|
||||
assert.ErrorIs(t, err, data.ErrNotFound, clues.ToCore(err))
|
||||
assert.ErrorIs(t, err, errs.NotFound, clues.ToCore(err))
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
@ -7,6 +7,7 @@ import (
|
||||
"github.com/alcionai/clues"
|
||||
"golang.org/x/exp/slices"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
"github.com/alcionai/corso/src/pkg/logger"
|
||||
@ -92,7 +93,7 @@ func (mc *mergeCollection) Items(
|
||||
}
|
||||
|
||||
// Fetch goes through all the collections in this one and returns the first
|
||||
// match found or the first error that is not data.ErrNotFound. If multiple
|
||||
// match found or the first error that is not errs.NotFound. If multiple
|
||||
// collections have the requested item, the instance in the collection with the
|
||||
// lexicographically smallest storage path is returned.
|
||||
func (mc *mergeCollection) FetchItemByName(
|
||||
@ -113,11 +114,11 @@ func (mc *mergeCollection) FetchItemByName(
|
||||
s, err := c.FetchItemByName(ictx, name)
|
||||
if err == nil {
|
||||
return s, nil
|
||||
} else if err != nil && !errors.Is(err, data.ErrNotFound) {
|
||||
} else if err != nil && !errors.Is(err, errs.NotFound) {
|
||||
return nil, clues.Wrap(err, "fetching from merged collection").
|
||||
WithClues(ictx)
|
||||
}
|
||||
}
|
||||
|
||||
return nil, clues.Wrap(data.ErrNotFound, "merged collection fetch")
|
||||
return nil, clues.Wrap(errs.NotFound, "merged collection fetch")
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/common/readers"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/m365/service/exchange/mock"
|
||||
@ -292,7 +293,7 @@ func (suite *MergeCollectionUnitSuite) TestFetchItemByName() {
|
||||
|
||||
if err != nil {
|
||||
if test.notFoundErr {
|
||||
assert.ErrorIs(t, err, data.ErrNotFound, clues.ToCore(err))
|
||||
assert.ErrorIs(t, err, errs.NotFound, clues.ToCore(err))
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
@ -11,7 +11,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/model"
|
||||
"github.com/alcionai/corso/src/pkg/store"
|
||||
)
|
||||
@ -292,7 +292,7 @@ func (ms *ModelStore) getModelStoreID(
|
||||
}
|
||||
|
||||
if len(metadata) == 0 {
|
||||
return "", clues.Wrap(data.ErrNotFound, "getting ModelStoreID").WithClues(ctx)
|
||||
return "", clues.Wrap(errs.NotFound, "getting ModelStoreID").WithClues(ctx)
|
||||
}
|
||||
|
||||
if len(metadata) != 1 {
|
||||
@ -347,7 +347,7 @@ func (ms *ModelStore) GetWithModelStoreID(
|
||||
metadata, err := ms.c.GetManifest(ctx, id, m)
|
||||
if err != nil {
|
||||
if errors.Is(err, manifest.ErrNotFound) {
|
||||
err = data.ErrNotFound
|
||||
err = errs.NotFound
|
||||
}
|
||||
|
||||
return clues.Wrap(err, "getting model data").WithClues(ctx)
|
||||
@ -490,7 +490,7 @@ func (ms *ModelStore) Delete(ctx context.Context, s model.Schema, id model.Stabl
|
||||
|
||||
latest, err := ms.getModelStoreID(ctx, s, id)
|
||||
if err != nil {
|
||||
if errors.Is(err, data.ErrNotFound) {
|
||||
if errors.Is(err, errs.NotFound) {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/model"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/pkg/backup"
|
||||
@ -381,10 +381,10 @@ func (suite *ModelStoreIntegrationSuite) TestGet_NotFoundErrors() {
|
||||
t := suite.T()
|
||||
|
||||
err := suite.m.Get(suite.ctx, model.BackupOpSchema, "baz", nil)
|
||||
assert.ErrorIs(t, err, data.ErrNotFound, clues.ToCore(err))
|
||||
assert.ErrorIs(t, err, errs.NotFound, clues.ToCore(err))
|
||||
|
||||
err = suite.m.GetWithModelStoreID(suite.ctx, model.BackupOpSchema, "baz", nil)
|
||||
assert.ErrorIs(t, err, data.ErrNotFound, clues.ToCore(err))
|
||||
assert.ErrorIs(t, err, errs.NotFound, clues.ToCore(err))
|
||||
}
|
||||
|
||||
func (suite *ModelStoreIntegrationSuite) TestPutGetOfTypeBadVersion() {
|
||||
@ -670,7 +670,7 @@ func (suite *ModelStoreIntegrationSuite) TestPutUpdate() {
|
||||
}
|
||||
|
||||
err = m.GetWithModelStoreID(ctx, theModelType, oldModelID, nil)
|
||||
assert.ErrorIs(t, err, data.ErrNotFound, clues.ToCore(err))
|
||||
assert.ErrorIs(t, err, errs.NotFound, clues.ToCore(err))
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -737,7 +737,7 @@ func (suite *ModelStoreIntegrationSuite) TestPutDelete() {
|
||||
|
||||
returned := &fooModel{}
|
||||
err = suite.m.GetWithModelStoreID(suite.ctx, theModelType, foo.ModelStoreID, returned)
|
||||
assert.ErrorIs(t, err, data.ErrNotFound, clues.ToCore(err))
|
||||
assert.ErrorIs(t, err, errs.NotFound, clues.ToCore(err))
|
||||
}
|
||||
|
||||
func (suite *ModelStoreIntegrationSuite) TestPutDeleteBatch() {
|
||||
@ -760,7 +760,7 @@ func (suite *ModelStoreIntegrationSuite) TestPutDeleteBatch() {
|
||||
for _, id := range ids {
|
||||
returned := &fooModel{}
|
||||
err := suite.m.GetWithModelStoreID(suite.ctx, theModelType, id, returned)
|
||||
assert.ErrorIs(t, err, data.ErrNotFound, clues.ToCore(err))
|
||||
assert.ErrorIs(t, err, errs.NotFound, clues.ToCore(err))
|
||||
}
|
||||
}
|
||||
|
||||
@ -843,7 +843,7 @@ func (suite *ModelStoreRegressionSuite) TestFailDuringWriteSessionHasNoVisibleEf
|
||||
assert.ErrorIs(t, err, assert.AnError, clues.ToCore(err))
|
||||
|
||||
err = m.GetWithModelStoreID(ctx, theModelType, newID, nil)
|
||||
assert.ErrorIs(t, err, data.ErrNotFound, clues.ToCore(err))
|
||||
assert.ErrorIs(t, err, errs.NotFound, clues.ToCore(err))
|
||||
|
||||
returned := &fooModel{}
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@ import (
|
||||
"github.com/kopia/kopia/snapshot/snapshotfs"
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/common/prefixmatcher"
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
@ -133,7 +134,7 @@ func (cp *corsoProgress) FinishedFile(relativePath string, err error) {
|
||||
}
|
||||
|
||||
info, err := d.infoer.Info()
|
||||
if errors.Is(err, data.ErrNotFound) {
|
||||
if errors.Is(err, errs.NotFound) {
|
||||
// The item was deleted between enumeration and trying to get data. Skip
|
||||
// adding it to details since there's no data for it.
|
||||
return
|
||||
|
||||
@ -17,6 +17,7 @@ import (
|
||||
"github.com/kopia/kopia/snapshot/snapshotmaintenance"
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/common/prefixmatcher"
|
||||
"github.com/alcionai/corso/src/internal/common/readers"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
@ -370,7 +371,7 @@ func getDir(
|
||||
encodeElements(dirPath.PopFront().Elements()...))
|
||||
if err != nil {
|
||||
if isErrEntryNotFound(err) {
|
||||
err = clues.Stack(data.ErrNotFound, err).WithClues(ctx)
|
||||
err = clues.Stack(errs.NotFound, err).WithClues(ctx)
|
||||
}
|
||||
|
||||
return nil, clues.Wrap(err, "getting nested object handle").WithClues(ctx)
|
||||
|
||||
@ -21,6 +21,7 @@ import (
|
||||
"github.com/stretchr/testify/suite"
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
pmMock "github.com/alcionai/corso/src/internal/common/prefixmatcher/mock"
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
@ -1398,7 +1399,7 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections_ReaderError() {
|
||||
// Files that had an error shouldn't make a dir entry in kopia. If they do we
|
||||
// may run into kopia-assisted incrementals issues because only mod time and
|
||||
// not file size is checked for StreamingFiles.
|
||||
assert.ErrorIs(t, errs.Failure(), data.ErrNotFound, "errored file is restorable", clues.ToCore(err))
|
||||
assert.ErrorIs(t, errs.Failure(), errs.NotFound, "errored file is restorable", clues.ToCore(err))
|
||||
}
|
||||
|
||||
type backedupFile struct {
|
||||
|
||||
@ -16,6 +16,7 @@ import (
|
||||
"golang.org/x/exp/maps"
|
||||
"golang.org/x/exp/slices"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/common/readers"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
@ -625,7 +626,7 @@ func (suite *CollectionUnitSuite) TestLazyItem_ReturnsEmptyReaderOnDeletedInFlig
|
||||
assert.Empty(t, readData, "read item data")
|
||||
|
||||
_, err = li.Info()
|
||||
assert.ErrorIs(t, err, data.ErrNotFound, "Info() error")
|
||||
assert.ErrorIs(t, err, errs.NotFound, "Info() error")
|
||||
}
|
||||
|
||||
func (suite *CollectionUnitSuite) TestLazyItem() {
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/kopia"
|
||||
"github.com/alcionai/corso/src/internal/kopia/inject"
|
||||
@ -128,7 +129,7 @@ func getManifestsAndMetadata(
|
||||
// should be safe to leave this manifest in the AssistBases set, though we
|
||||
// could remove it there too if we want to be conservative. That can be done
|
||||
// by finding the manifest ID.
|
||||
if err != nil && !errors.Is(err, data.ErrNotFound) {
|
||||
if err != nil && !errors.Is(err, errs.NotFound) {
|
||||
// prior metadata isn't guaranteed to exist.
|
||||
// if it doesn't, we'll just have to do a
|
||||
// full backup for that data.
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/kopia"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||
@ -207,7 +207,7 @@ func (suite *StreamStoreIntgSuite) TestStreamer() {
|
||||
snapid,
|
||||
DetailsReader(details.UnmarshalTo(&readDeets)),
|
||||
fault.New(true))
|
||||
assert.ErrorIs(t, err, data.ErrNotFound)
|
||||
assert.ErrorIs(t, err, errs.NotFound)
|
||||
assert.Empty(t, readDeets)
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ func (suite *StreamStoreIntgSuite) TestStreamer() {
|
||||
snapid,
|
||||
FaultErrorsReader(fault.UnmarshalErrorsTo(&readErrs)),
|
||||
fault.New(true))
|
||||
assert.ErrorIs(t, err, data.ErrNotFound)
|
||||
assert.ErrorIs(t, err, errs.NotFound)
|
||||
assert.Empty(t, readErrs)
|
||||
}
|
||||
})
|
||||
|
||||
@ -7,8 +7,8 @@ import (
|
||||
"github.com/kopia/kopia/repo/manifest"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/common/idname"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/kopia"
|
||||
"github.com/alcionai/corso/src/internal/m365/collection/drive/metadata"
|
||||
"github.com/alcionai/corso/src/internal/model"
|
||||
@ -330,7 +330,7 @@ func deleteBackups(
|
||||
for _, id := range ids {
|
||||
b, err := sw.GetBackup(ctx, model.StableID(id))
|
||||
if err != nil {
|
||||
if !failOnMissing && errors.Is(err, data.ErrNotFound) {
|
||||
if !failOnMissing && errors.Is(err, errs.NotFound) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/crash"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/events"
|
||||
"github.com/alcionai/corso/src/internal/kopia"
|
||||
"github.com/alcionai/corso/src/internal/model"
|
||||
@ -385,7 +385,7 @@ func newRepoID(s storage.Storage) string {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
func errWrapper(err error) error {
|
||||
if errors.Is(err, data.ErrNotFound) {
|
||||
if errors.Is(err, errs.NotFound) {
|
||||
return clues.Stack(ErrorBackupNotFound, err)
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/common/errs"
|
||||
"github.com/alcionai/corso/src/internal/kopia"
|
||||
"github.com/alcionai/corso/src/internal/model"
|
||||
"github.com/alcionai/corso/src/internal/operations"
|
||||
@ -107,11 +107,11 @@ func (suite *RepositoryBackupsUnitSuite) TestGetBackup() {
|
||||
name: "get error",
|
||||
sw: mock.BackupWrapper{
|
||||
Backup: bup,
|
||||
GetErr: data.ErrNotFound,
|
||||
GetErr: errs.NotFound,
|
||||
DeleteErr: nil,
|
||||
},
|
||||
expectErr: func(t *testing.T, result error) {
|
||||
assert.ErrorIs(t, result, data.ErrNotFound, clues.ToCore(result))
|
||||
assert.ErrorIs(t, result, errs.NotFound, clues.ToCore(result))
|
||||
assert.ErrorIs(t, result, ErrorBackupNotFound, clues.ToCore(result))
|
||||
},
|
||||
expectID: bup.ID,
|
||||
@ -446,14 +446,14 @@ func (suite *RepositoryBackupsUnitSuite) TestDeleteBackups() {
|
||||
bup.ID,
|
||||
},
|
||||
gets: []getRes{
|
||||
{err: data.ErrNotFound},
|
||||
{err: errs.NotFound},
|
||||
},
|
||||
expectGets: []model.StableID{
|
||||
bup.ID,
|
||||
},
|
||||
failOnMissing: true,
|
||||
expectErr: func(t *testing.T, result error) {
|
||||
assert.ErrorIs(t, result, data.ErrNotFound, clues.ToCore(result))
|
||||
assert.ErrorIs(t, result, errs.NotFound, clues.ToCore(result))
|
||||
assert.ErrorIs(t, result, ErrorBackupNotFound, clues.ToCore(result))
|
||||
},
|
||||
},
|
||||
@ -598,7 +598,7 @@ func (suite *RepositoryBackupsUnitSuite) TestDeleteBackups() {
|
||||
{bup: bup},
|
||||
{bup: bupLegacy},
|
||||
{bup: bupNoSnapshot},
|
||||
{err: data.ErrNotFound},
|
||||
{err: errs.NotFound},
|
||||
},
|
||||
expectGets: []model.StableID{
|
||||
bup.ID,
|
||||
@ -608,7 +608,7 @@ func (suite *RepositoryBackupsUnitSuite) TestDeleteBackups() {
|
||||
},
|
||||
failOnMissing: true,
|
||||
expectErr: func(t *testing.T, result error) {
|
||||
assert.ErrorIs(t, result, data.ErrNotFound, clues.ToCore(result))
|
||||
assert.ErrorIs(t, result, errs.NotFound, clues.ToCore(result))
|
||||
assert.ErrorIs(t, result, ErrorBackupNotFound, clues.ToCore(result))
|
||||
},
|
||||
},
|
||||
@ -622,7 +622,7 @@ func (suite *RepositoryBackupsUnitSuite) TestDeleteBackups() {
|
||||
},
|
||||
gets: []getRes{
|
||||
{bup: bup},
|
||||
{err: data.ErrNotFound},
|
||||
{err: errs.NotFound},
|
||||
{bup: bupNoSnapshot},
|
||||
{bup: bupNoDetails},
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user