From 66f734b4dbfbbf9b8ae14119e86e2bfb800cf4db Mon Sep 17 00:00:00 2001 From: ryanfkeepers Date: Tue, 14 Feb 2023 15:15:38 -0700 Subject: [PATCH] watch for et errors --- src/internal/connector/discovery/api/users.go | 2 +- src/internal/connector/exchange/data_collections.go | 2 +- src/internal/connector/exchange/service_iterators.go | 4 ++-- src/internal/connector/exchange/service_restore.go | 6 +++--- src/internal/connector/graph_connector.go | 2 +- src/internal/connector/sharepoint/api/pages.go | 2 +- src/internal/connector/sharepoint/collection.go | 4 ++-- src/internal/connector/sharepoint/data_collections.go | 6 +++--- src/internal/connector/sharepoint/list.go | 6 +++--- src/internal/connector/sharepoint/restore.go | 4 ++-- src/internal/kopia/wrapper.go | 2 +- src/internal/operations/manifests.go | 2 +- src/internal/operations/restore.go | 2 +- src/pkg/fault/example_fault_test.go | 7 ++----- 14 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/internal/connector/discovery/api/users.go b/src/internal/connector/discovery/api/users.go index a88013d4c..05528eb2c 100644 --- a/src/internal/connector/discovery/api/users.go +++ b/src/internal/connector/discovery/api/users.go @@ -114,7 +114,7 @@ func (c Users) GetAll(ctx context.Context, errs *fault.Errors) ([]models.Userabl ) iterator := func(item any) bool { - if errs.Err() != nil { + if et.Err() != nil { return false } diff --git a/src/internal/connector/exchange/data_collections.go b/src/internal/connector/exchange/data_collections.go index 432176bc9..1d62d4f56 100644 --- a/src/internal/connector/exchange/data_collections.go +++ b/src/internal/connector/exchange/data_collections.go @@ -187,7 +187,7 @@ func DataCollections( } for _, scope := range eb.Scopes() { - if errs.Err() != nil { + if et.Err() != nil { break } diff --git a/src/internal/connector/exchange/service_iterators.go b/src/internal/connector/exchange/service_iterators.go index ec7db0d78..02f9d92b0 100644 --- a/src/internal/connector/exchange/service_iterators.go +++ b/src/internal/connector/exchange/service_iterators.go @@ -71,7 +71,7 @@ func filterContainersAndFillCollections( et := errs.Tracker() for _, c := range resolver.Items() { - if errs.Err() != nil { + if et.Err() != nil { return et.Err() } @@ -157,7 +157,7 @@ func filterContainersAndFillCollections( // in the `previousPath` set, but does not exist in the current container // resolver (which contains all the resource owners' current containers). for id, p := range tombstones { - if errs.Err() != nil { + if et.Err() != nil { return et.Err() } diff --git a/src/internal/connector/exchange/service_restore.go b/src/internal/connector/exchange/service_restore.go index af73554d7..dff05be54 100644 --- a/src/internal/connector/exchange/service_restore.go +++ b/src/internal/connector/exchange/service_restore.go @@ -140,7 +140,7 @@ func RestoreExchangeEvent( } for _, attach := range attached { - if errs.Err() != nil { + if et.Err() != nil { break } @@ -268,7 +268,7 @@ func SendMailToBackStore( ) for _, attachment := range attached { - if errs.Err() != nil { + if et.Err() != nil { break } @@ -319,7 +319,7 @@ func RestoreExchangeDataCollections( } for _, dc := range dcs { - if errs.Err() != nil { + if et.Err() != nil { break } diff --git a/src/internal/connector/graph_connector.go b/src/internal/connector/graph_connector.go index e849cb966..912cb6e4b 100644 --- a/src/internal/connector/graph_connector.go +++ b/src/internal/connector/graph_connector.go @@ -333,7 +333,7 @@ func getResources( et := errs.Tracker() callbackFunc := func(item any) bool { - if errs.Err() != nil { + if et.Err() != nil { return false } diff --git a/src/internal/connector/sharepoint/api/pages.go b/src/internal/connector/sharepoint/api/pages.go index 04596619d..8f33760fb 100644 --- a/src/internal/connector/sharepoint/api/pages.go +++ b/src/internal/connector/sharepoint/api/pages.go @@ -49,7 +49,7 @@ func GetSitePages( } for _, entry := range pages { - if errs.Err() != nil { + if et.Err() != nil { break } diff --git a/src/internal/connector/sharepoint/collection.go b/src/internal/connector/sharepoint/collection.go index 451c0b0e8..121f70d70 100644 --- a/src/internal/connector/sharepoint/collection.go +++ b/src/internal/connector/sharepoint/collection.go @@ -237,7 +237,7 @@ func (sc *Collection) retrieveLists( // For each models.Listable, object is serialized and the metrics are collected. // The progress is objected via the passed in channel. for _, lst := range lists { - if errs.Err() != nil { + if et.Err() != nil { break } @@ -298,7 +298,7 @@ func (sc *Collection) retrievePages( // Pageable objects are not supported in v1.0 of msgraph at this time. // TODO: Verify Parsable interface supported with modified-Pageable for _, pg := range pages { - if errs.Err() != nil { + if et.Err() != nil { break } diff --git a/src/internal/connector/sharepoint/data_collections.go b/src/internal/connector/sharepoint/data_collections.go index 79b5ac739..6a9373781 100644 --- a/src/internal/connector/sharepoint/data_collections.go +++ b/src/internal/connector/sharepoint/data_collections.go @@ -50,7 +50,7 @@ func DataCollections( ) for _, scope := range b.Scopes() { - if errs.Err() != nil { + if et.Err() != nil { break } @@ -136,7 +136,7 @@ func collectLists( } for _, tuple := range lists { - if errs.Err() != nil { + if et.Err() != nil { break } @@ -228,7 +228,7 @@ func collectPages( } for _, tuple := range tuples { - if errs.Err() != nil { + if et.Err() != nil { break } diff --git a/src/internal/connector/sharepoint/list.go b/src/internal/connector/sharepoint/list.go index 2f39e45da..f753d847e 100644 --- a/src/internal/connector/sharepoint/list.go +++ b/src/internal/connector/sharepoint/list.go @@ -112,7 +112,7 @@ func loadSiteLists( } for _, listID := range listIDs { - if errs.Err() != nil { + if et.Err() != nil { break } @@ -213,7 +213,7 @@ func fetchListItems( } for _, itm := range resp.GetValue() { - if errs.Err() != nil { + if et.Err() != nil { break } @@ -319,7 +319,7 @@ func fetchContentTypes( } for _, cont := range resp.GetValue() { - if errs.Err() != nil { + if et.Err() != nil { break } diff --git a/src/internal/connector/sharepoint/restore.go b/src/internal/connector/sharepoint/restore.go index 00a53d180..174189179 100644 --- a/src/internal/connector/sharepoint/restore.go +++ b/src/internal/connector/sharepoint/restore.go @@ -232,7 +232,7 @@ func RestoreListCollection( trace.Log(ctx, "gc:sharepoint:restoreListCollection", directory.String()) for { - if errs.Err() != nil { + if et.Err() != nil { break } @@ -315,7 +315,7 @@ func RestorePageCollection( ) for { - if errs.Err() != nil { + if et.Err() != nil { break } diff --git a/src/internal/kopia/wrapper.go b/src/internal/kopia/wrapper.go index 5d1ecc895..732872c65 100644 --- a/src/internal/kopia/wrapper.go +++ b/src/internal/kopia/wrapper.go @@ -404,7 +404,7 @@ func (w Wrapper) RestoreMultipleItems( ) for _, itemPath := range paths { - if errs.Err() != nil { + if et.Err() != nil { return nil, et.Err() } diff --git a/src/internal/operations/manifests.go b/src/internal/operations/manifests.go index c9e1e0cae..305443b07 100644 --- a/src/internal/operations/manifests.go +++ b/src/internal/operations/manifests.go @@ -143,7 +143,7 @@ func verifyDistinctBases(ctx context.Context, mans []*kopia.ManifestEntry, errs ) for _, man := range mans { - if errs.Err() != nil { + if et.Err() != nil { break } diff --git a/src/internal/operations/restore.go b/src/internal/operations/restore.go index 75133bf40..0db490cb5 100644 --- a/src/internal/operations/restore.go +++ b/src/internal/operations/restore.go @@ -358,7 +358,7 @@ func formatDetailsForRestoration( ) for i := range fdsPaths { - if errs.Err() != nil { + if et.Err() != nil { break } diff --git a/src/pkg/fault/example_fault_test.go b/src/pkg/fault/example_fault_test.go index 6552a6ad6..38e191309 100644 --- a/src/pkg/fault/example_fault_test.go +++ b/src/pkg/fault/example_fault_test.go @@ -224,7 +224,7 @@ func ExampleErrors_Errs() { // Err() is nil } -func ExampleTracker() { +func ExampleErrors_Tracker() { // It is common for Corso to run operations in parallel, // and for iterations to be nested within iterations. To // avoid mistakenly returning an error that was sourced @@ -235,10 +235,7 @@ func ExampleTracker() { err := func() error { for i := range items { - // note that we check errs.Err() on every iteration, - // not trkr.Err(). The loop should break if any - // hard failure occurs, not just one within this loop. - if errs.Err() != nil { + if trkr.Err() != nil { break }