replace errors.* with clues.* (#2924)
Mostly find/replace on errors.N and errors.W. Also turns all wrapf into wrap, and removes as many errorf calls as possible. Might follow up with a linter to enforce this change. --- #### Does this PR need a docs update or release note? - [x] ⛔ No #### Type of change - [x] 🧹 Tech Debt/Cleanup #### Issue(s) * #1970 #### Test Plan - [x] ⚡ Unit test - [x] 💚 E2E
This commit is contained in:
parent
c6be513ea6
commit
9d73d0c8e2
@ -6,6 +6,9 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/alcionai/corso/src/cli/config"
|
||||
"github.com/alcionai/corso/src/cli/options"
|
||||
. "github.com/alcionai/corso/src/cli/print"
|
||||
@ -19,8 +22,6 @@ import (
|
||||
"github.com/alcionai/corso/src/pkg/repository"
|
||||
"github.com/alcionai/corso/src/pkg/selectors"
|
||||
"github.com/alcionai/corso/src/pkg/store"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -235,7 +236,7 @@ func runBackups(
|
||||
|
||||
bups, berrs := r.Backups(ctx, bIDs)
|
||||
if berrs.Failure() != nil {
|
||||
return Only(ctx, errors.Wrap(berrs.Failure(), "Unable to retrieve backup results from storage"))
|
||||
return Only(ctx, clues.Wrap(berrs.Failure(), "Unable to retrieve backup results from storage"))
|
||||
}
|
||||
|
||||
Info(ctx, "Completed Backups:")
|
||||
@ -258,7 +259,7 @@ func runBackups(
|
||||
// genericDeleteCommand is a helper function that all services can use
|
||||
// for the removal of an entry from the repository
|
||||
func genericDeleteCommand(cmd *cobra.Command, bID, designation string, args []string) error {
|
||||
ctx := cmd.Context()
|
||||
ctx := clues.Add(cmd.Context(), "delete_backup_id", bID)
|
||||
|
||||
if utils.HasNoFlagsAndShownHelp(cmd) {
|
||||
return nil
|
||||
@ -272,7 +273,7 @@ func genericDeleteCommand(cmd *cobra.Command, bID, designation string, args []st
|
||||
defer utils.CloseRepo(ctx, r)
|
||||
|
||||
if err := r.DeleteBackup(ctx, model.StableID(bID)); err != nil {
|
||||
return Only(ctx, errors.Wrapf(err, "Deleting backup %s", bID))
|
||||
return Only(ctx, clues.Wrap(err, "Deleting backup "+bID))
|
||||
}
|
||||
|
||||
Infof(ctx, "Deleted %s backup %s", designation, bID)
|
||||
@ -296,10 +297,10 @@ func genericListCommand(cmd *cobra.Command, bID string, service path.ServiceType
|
||||
fe, b, errs := r.GetBackupErrors(ctx, bID)
|
||||
if errs.Failure() != nil {
|
||||
if errors.Is(errs.Failure(), data.ErrNotFound) {
|
||||
return Only(ctx, errors.Errorf("No backup exists with the id %s", bID))
|
||||
return Only(ctx, clues.New("No backup exists with the id "+bID))
|
||||
}
|
||||
|
||||
return Only(ctx, errors.Wrap(err, "Failed to find backup "+bID))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to find backup "+bID))
|
||||
}
|
||||
|
||||
b.Print(ctx)
|
||||
@ -310,7 +311,7 @@ func genericListCommand(cmd *cobra.Command, bID string, service path.ServiceType
|
||||
|
||||
bs, err := r.BackupsByTag(ctx, store.Service(service))
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrap(err, "Failed to list backups in the repository"))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to list backups in the repository"))
|
||||
}
|
||||
|
||||
backup.PrintAll(ctx, bs)
|
||||
@ -326,7 +327,7 @@ func getAccountAndConnect(ctx context.Context) (repository.Repository, *account.
|
||||
|
||||
r, err := repository.Connect(ctx, cfg.Account, cfg.Storage, options.Control())
|
||||
if err != nil {
|
||||
return nil, nil, errors.Wrapf(err, "Failed to connect to the %s repository", cfg.Storage.Provider)
|
||||
return nil, nil, clues.Wrap(err, "Failed to connect to the "+cfg.Storage.Provider.String()+" repository")
|
||||
}
|
||||
|
||||
return r, &cfg.Account, nil
|
||||
|
||||
@ -3,11 +3,11 @@ package backup
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/cli/options"
|
||||
. "github.com/alcionai/corso/src/cli/print"
|
||||
"github.com/alcionai/corso/src/cli/utils"
|
||||
@ -171,7 +171,7 @@ func createExchangeCmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
users, err := m365.UserPNs(ctx, *acct, errs)
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrap(err, "Failed to retrieve M365 user(s)"))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to retrieve M365 user(s)"))
|
||||
}
|
||||
|
||||
selectorSet := []selectors.Selector{}
|
||||
@ -213,12 +213,12 @@ func exchangeBackupCreateSelectors(userIDs, cats []string) *selectors.ExchangeBa
|
||||
|
||||
func validateExchangeBackupCreateFlags(userIDs, cats []string) error {
|
||||
if len(userIDs) == 0 {
|
||||
return errors.New("--user requires one or more email addresses or the wildcard '*'")
|
||||
return clues.New("--user requires one or more email addresses or the wildcard '*'")
|
||||
}
|
||||
|
||||
for _, d := range cats {
|
||||
if d != dataContacts && d != dataEmail && d != dataEvents {
|
||||
return errors.New(
|
||||
return clues.New(
|
||||
d + " is an unrecognized data type; must be one of " + dataContacts + ", " + dataEmail + ", or " + dataEvents)
|
||||
}
|
||||
}
|
||||
@ -336,10 +336,10 @@ func runDetailsExchangeCmd(
|
||||
// TODO: log/track recoverable errors
|
||||
if errs.Failure() != nil {
|
||||
if errors.Is(errs.Failure(), data.ErrNotFound) {
|
||||
return nil, errors.Errorf("No backup exists with the id %s", backupID)
|
||||
return nil, clues.New("No backup exists with the id " + backupID)
|
||||
}
|
||||
|
||||
return nil, errors.Wrap(errs.Failure(), "Failed to get backup details in the repository")
|
||||
return nil, clues.Wrap(errs.Failure(), "Failed to get backup details in the repository")
|
||||
}
|
||||
|
||||
ctx = clues.Add(ctx, "details_entries", len(d.Entries))
|
||||
|
||||
@ -5,13 +5,13 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/google/uuid"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/cli"
|
||||
"github.com/alcionai/corso/src/cli/config"
|
||||
"github.com/alcionai/corso/src/cli/print"
|
||||
|
||||
@ -3,12 +3,12 @@ package backup
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/cli/utils"
|
||||
"github.com/alcionai/corso/src/cli/utils/testdata"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
|
||||
@ -3,11 +3,11 @@ package backup
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/cli/options"
|
||||
. "github.com/alcionai/corso/src/cli/print"
|
||||
"github.com/alcionai/corso/src/cli/utils"
|
||||
@ -146,7 +146,7 @@ func createOneDriveCmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
users, err := m365.UserPNs(ctx, *acct, errs)
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrap(err, "Failed to retrieve M365 users"))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to retrieve M365 users"))
|
||||
}
|
||||
|
||||
selectorSet := []selectors.Selector{}
|
||||
@ -165,7 +165,7 @@ func createOneDriveCmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
func validateOneDriveBackupCreateFlags(users []string) error {
|
||||
if len(users) == 0 {
|
||||
return errors.New("requires one or more --user ids or the wildcard --user *")
|
||||
return clues.New("requires one or more --user ids or the wildcard --user *")
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -275,10 +275,10 @@ func runDetailsOneDriveCmd(
|
||||
// TODO: log/track recoverable errors
|
||||
if errs.Failure() != nil {
|
||||
if errors.Is(errs.Failure(), data.ErrNotFound) {
|
||||
return nil, errors.Errorf("no backup exists with the id %s", backupID)
|
||||
return nil, clues.New("no backup exists with the id " + backupID)
|
||||
}
|
||||
|
||||
return nil, errors.Wrap(errs.Failure(), "Failed to get backup details in the repository")
|
||||
return nil, clues.Wrap(errs.Failure(), "Failed to get backup details in the repository")
|
||||
}
|
||||
|
||||
ctx = clues.Add(ctx, "details_entries", len(d.Entries))
|
||||
|
||||
@ -5,13 +5,13 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/google/uuid"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/cli"
|
||||
"github.com/alcionai/corso/src/cli/config"
|
||||
"github.com/alcionai/corso/src/cli/print"
|
||||
|
||||
@ -3,12 +3,12 @@ package backup
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/cli/utils/testdata"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
)
|
||||
|
||||
@ -3,11 +3,11 @@ package backup
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/cli/options"
|
||||
. "github.com/alcionai/corso/src/cli/print"
|
||||
"github.com/alcionai/corso/src/cli/utils"
|
||||
@ -161,12 +161,12 @@ func createSharePointCmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
gc, err := connector.NewGraphConnector(ctx, graph.HTTPClient(graph.NoTimeout()), *acct, connector.Sites, errs)
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrap(err, "Failed to connect to Microsoft APIs"))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to connect to Microsoft APIs"))
|
||||
}
|
||||
|
||||
sel, err := sharePointBackupCreateSelectors(ctx, utils.SiteID, utils.WebURL, sharepointData, gc)
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrap(err, "Retrieving up sharepoint sites by ID and URL"))
|
||||
return Only(ctx, clues.Wrap(err, "Retrieving up sharepoint sites by ID and URL"))
|
||||
}
|
||||
|
||||
selectorSet := []selectors.Selector{}
|
||||
@ -185,7 +185,7 @@ func createSharePointCmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
func validateSharePointBackupCreateFlags(sites, weburls, cats []string) error {
|
||||
if len(sites) == 0 && len(weburls) == 0 {
|
||||
return errors.New(
|
||||
return clues.New(
|
||||
"requires one or more --" +
|
||||
utils.SiteFN + " urls, or the wildcard --" +
|
||||
utils.SiteFN + " *",
|
||||
@ -194,7 +194,7 @@ func validateSharePointBackupCreateFlags(sites, weburls, cats []string) error {
|
||||
|
||||
for _, d := range cats {
|
||||
if d != dataLibraries && d != dataPages {
|
||||
return errors.New(
|
||||
return clues.New(
|
||||
d + " is an unrecognized data type; either " + dataLibraries + "or " + dataPages,
|
||||
)
|
||||
}
|
||||
@ -383,10 +383,10 @@ func runDetailsSharePointCmd(
|
||||
// TODO: log/track recoverable errors
|
||||
if errs.Failure() != nil {
|
||||
if errors.Is(errs.Failure(), data.ErrNotFound) {
|
||||
return nil, errors.Errorf("no backup exists with the id %s", backupID)
|
||||
return nil, clues.New("no backup exists with the id " + backupID)
|
||||
}
|
||||
|
||||
return nil, errors.Wrap(errs.Failure(), "Failed to get backup details in the repository")
|
||||
return nil, clues.Wrap(errs.Failure(), "Failed to get backup details in the repository")
|
||||
}
|
||||
|
||||
ctx = clues.Add(ctx, "details_entries", len(d.Entries))
|
||||
|
||||
@ -5,13 +5,13 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/google/uuid"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/cli"
|
||||
"github.com/alcionai/corso/src/cli/config"
|
||||
"github.com/alcionai/corso/src/cli/print"
|
||||
|
||||
@ -3,12 +3,12 @@ package backup
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/cli/utils"
|
||||
"github.com/alcionai/corso/src/cli/utils/testdata"
|
||||
"github.com/alcionai/corso/src/internal/connector"
|
||||
|
||||
@ -3,7 +3,7 @@ package config
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/alcionai/corso/src/cli/utils"
|
||||
@ -18,7 +18,7 @@ func m365ConfigsFromViper(vpr *viper.Viper) (account.M365Config, error) {
|
||||
|
||||
providerType := vpr.GetString(AccountProviderTypeKey)
|
||||
if providerType != account.ProviderM365.String() {
|
||||
return m365, errors.New("unsupported account provider: " + providerType)
|
||||
return m365, clues.New("unsupported account provider: " + providerType)
|
||||
}
|
||||
|
||||
m365.AzureTenantID = vpr.GetString(AzureTenantIDKey)
|
||||
@ -49,18 +49,18 @@ func configureAccount(
|
||||
if readConfigFromViper {
|
||||
m365Cfg, err = m365ConfigsFromViper(vpr)
|
||||
if err != nil {
|
||||
return acct, errors.Wrap(err, "reading m365 configs from corso config file")
|
||||
return acct, clues.Wrap(err, "reading m365 configs from corso config file")
|
||||
}
|
||||
|
||||
if err := mustMatchConfig(vpr, m365Overrides(overrides)); err != nil {
|
||||
return acct, errors.Wrap(err, "verifying m365 configs in corso config file")
|
||||
return acct, clues.Wrap(err, "verifying m365 configs in corso config file")
|
||||
}
|
||||
}
|
||||
|
||||
// compose the m365 config and credentials
|
||||
m365 := credentials.GetM365()
|
||||
if err := m365.Validate(); err != nil {
|
||||
return acct, errors.Wrap(err, "validating m365 credentials")
|
||||
return acct, clues.Wrap(err, "validating m365 credentials")
|
||||
}
|
||||
|
||||
m365Cfg = account.M365Config{
|
||||
@ -83,7 +83,7 @@ func configureAccount(
|
||||
// build the account
|
||||
acct, err = account.NewAccount(account.ProviderM365, m365Cfg)
|
||||
if err != nil {
|
||||
return acct, errors.Wrap(err, "retrieving m365 account configuration")
|
||||
return acct, clues.Wrap(err, "retrieving m365 account configuration")
|
||||
}
|
||||
|
||||
return acct, nil
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
@ -127,7 +127,7 @@ func initWithViper(vpr *viper.Viper, configFP string) error {
|
||||
|
||||
ext := filepath.Ext(configFP)
|
||||
if len(ext) == 0 {
|
||||
return errors.New("config file requires an extension e.g. `toml`")
|
||||
return clues.New("config file requires an extension e.g. `toml`")
|
||||
}
|
||||
|
||||
fileName := filepath.Base(configFP)
|
||||
@ -265,7 +265,7 @@ func getStorageAndAccountWithViper(
|
||||
err = vpr.ReadInConfig()
|
||||
if err != nil {
|
||||
if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
|
||||
return config, errors.Wrap(err, "reading corso config file: "+vpr.ConfigFileUsed())
|
||||
return config, clues.Wrap(err, "reading corso config file: "+vpr.ConfigFileUsed())
|
||||
}
|
||||
|
||||
readConfigFromViper = false
|
||||
@ -277,12 +277,12 @@ func getStorageAndAccountWithViper(
|
||||
|
||||
config.Account, err = configureAccount(vpr, readConfigFromViper, overrides)
|
||||
if err != nil {
|
||||
return config, errors.Wrap(err, "retrieving account configuration details")
|
||||
return config, clues.Wrap(err, "retrieving account configuration details")
|
||||
}
|
||||
|
||||
config.Storage, err = configureStorage(vpr, readConfigFromViper, overrides)
|
||||
if err != nil {
|
||||
return config, errors.Wrap(err, "retrieving storage provider details")
|
||||
return config, clues.Wrap(err, "retrieving storage provider details")
|
||||
}
|
||||
|
||||
return config, nil
|
||||
@ -317,7 +317,7 @@ func mustMatchConfig(vpr *viper.Viper, m map[string]string) error {
|
||||
|
||||
vv := vpr.GetString(tomlK)
|
||||
if v != vv {
|
||||
return errors.New("value of " + k + " (" + v + ") does not match corso configuration value (" + vv + ")")
|
||||
return clues.New("value of " + k + " (" + v + ") does not match corso configuration value (" + vv + ")")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,12 +6,12 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/pkg/account"
|
||||
"github.com/alcionai/corso/src/pkg/credentials"
|
||||
|
||||
@ -5,8 +5,8 @@ import (
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/aws/aws-sdk-go/aws/defaults"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/alcionai/corso/src/cli/utils"
|
||||
@ -21,7 +21,7 @@ func s3ConfigsFromViper(vpr *viper.Viper) (storage.S3Config, error) {
|
||||
|
||||
providerType := vpr.GetString(StorageProviderTypeKey)
|
||||
if providerType != storage.ProviderS3.String() {
|
||||
return s3Config, errors.New("unsupported storage provider: " + providerType)
|
||||
return s3Config, clues.New("unsupported storage provider: " + providerType)
|
||||
}
|
||||
|
||||
s3Config.Bucket = vpr.GetString(BucketNameKey)
|
||||
@ -59,7 +59,7 @@ func configureStorage(
|
||||
|
||||
if readConfigFromViper {
|
||||
if s3Cfg, err = s3ConfigsFromViper(vpr); err != nil {
|
||||
return store, errors.Wrap(err, "reading s3 configs from corso config file")
|
||||
return store, clues.Wrap(err, "reading s3 configs from corso config file")
|
||||
}
|
||||
|
||||
if b, ok := overrides[storage.Bucket]; ok {
|
||||
@ -71,13 +71,13 @@ func configureStorage(
|
||||
}
|
||||
|
||||
if err := mustMatchConfig(vpr, s3Overrides(overrides)); err != nil {
|
||||
return store, errors.Wrap(err, "verifying s3 configs in corso config file")
|
||||
return store, clues.Wrap(err, "verifying s3 configs in corso config file")
|
||||
}
|
||||
}
|
||||
|
||||
_, err = defaults.CredChain(defaults.Config().WithCredentialsChainVerboseErrors(true), defaults.Handlers()).Get()
|
||||
if err != nil {
|
||||
return store, errors.Wrap(err, "validating aws credentials")
|
||||
return store, clues.Wrap(err, "validating aws credentials")
|
||||
}
|
||||
|
||||
s3Cfg = storage.S3Config{
|
||||
@ -97,7 +97,7 @@ func configureStorage(
|
||||
// compose the common config and credentials
|
||||
corso := credentials.GetCorso()
|
||||
if err := corso.Validate(); err != nil {
|
||||
return store, errors.Wrap(err, "validating corso credentials")
|
||||
return store, clues.Wrap(err, "validating corso credentials")
|
||||
}
|
||||
|
||||
cCfg := storage.CommonConfig{
|
||||
@ -122,7 +122,7 @@ func configureStorage(
|
||||
// build the storage
|
||||
store, err = storage.NewStorage(storage.ProviderS3, s3Cfg, cCfg)
|
||||
if err != nil {
|
||||
return store, errors.Wrap(err, "configuring repository storage")
|
||||
return store, clues.Wrap(err, "configuring repository storage")
|
||||
}
|
||||
|
||||
return store, nil
|
||||
|
||||
@ -4,11 +4,11 @@ import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
)
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
@ -126,19 +127,19 @@ func initS3Cmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
s3Cfg, err := cfg.Storage.S3Config()
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrap(err, "Retrieving s3 configuration"))
|
||||
return Only(ctx, clues.Wrap(err, "Retrieving s3 configuration"))
|
||||
}
|
||||
|
||||
if strings.HasPrefix(s3Cfg.Endpoint, "http://") || strings.HasPrefix(s3Cfg.Endpoint, "https://") {
|
||||
invalidEndpointErr := "endpoint doesn't support specifying protocol. " +
|
||||
"pass --disable-tls flag to use http:// instead of default https://"
|
||||
|
||||
return Only(ctx, errors.New(invalidEndpointErr))
|
||||
return Only(ctx, clues.New(invalidEndpointErr))
|
||||
}
|
||||
|
||||
m365, err := cfg.Account.M365Config()
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrap(err, "Failed to parse m365 account config"))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to parse m365 account config"))
|
||||
}
|
||||
|
||||
r, err := repository.Initialize(ctx, cfg.Account, cfg.Storage, options.Control())
|
||||
@ -147,7 +148,7 @@ func initS3Cmd(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
return Only(ctx, errors.Wrap(err, "Failed to initialize a new S3 repository"))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to initialize a new S3 repository"))
|
||||
}
|
||||
|
||||
defer utils.CloseRepo(ctx, r)
|
||||
@ -155,7 +156,7 @@ func initS3Cmd(cmd *cobra.Command, args []string) error {
|
||||
Infof(ctx, "Initialized a S3 repository within bucket %s.", s3Cfg.Bucket)
|
||||
|
||||
if err = config.WriteRepoConfig(ctx, s3Cfg, m365, r.GetID()); err != nil {
|
||||
return Only(ctx, errors.Wrap(err, "Failed to write repository configuration"))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to write repository configuration"))
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -192,24 +193,24 @@ func connectS3Cmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
s3Cfg, err := cfg.Storage.S3Config()
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrap(err, "Retrieving s3 configuration"))
|
||||
return Only(ctx, clues.Wrap(err, "Retrieving s3 configuration"))
|
||||
}
|
||||
|
||||
m365, err := cfg.Account.M365Config()
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrap(err, "Failed to parse m365 account config"))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to parse m365 account config"))
|
||||
}
|
||||
|
||||
if strings.HasPrefix(s3Cfg.Endpoint, "http://") || strings.HasPrefix(s3Cfg.Endpoint, "https://") {
|
||||
invalidEndpointErr := "endpoint doesn't support specifying protocol. " +
|
||||
"pass --disable-tls flag to use http:// instead of default https://"
|
||||
|
||||
return Only(ctx, errors.New(invalidEndpointErr))
|
||||
return Only(ctx, clues.New(invalidEndpointErr))
|
||||
}
|
||||
|
||||
r, err := repository.ConnectAndSendConnectEvent(ctx, cfg.Account, cfg.Storage, options.Control())
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrap(err, "Failed to connect to the S3 repository"))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to connect to the S3 repository"))
|
||||
}
|
||||
|
||||
defer utils.CloseRepo(ctx, r)
|
||||
@ -217,7 +218,7 @@ func connectS3Cmd(cmd *cobra.Command, args []string) error {
|
||||
Infof(ctx, "Connected to S3 bucket %s.", s3Cfg.Bucket)
|
||||
|
||||
if err = config.WriteRepoConfig(ctx, s3Cfg, m365, r.GetID()); err != nil {
|
||||
return Only(ctx, errors.Wrap(err, "Failed to write repository configuration"))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to write repository configuration"))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@ -4,11 +4,11 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/cli"
|
||||
"github.com/alcionai/corso/src/cli/config"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package restore
|
||||
|
||||
import (
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
@ -138,7 +139,7 @@ func restoreExchangeCmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
r, err := repository.Connect(ctx, cfg.Account, cfg.Storage, options.Control())
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrapf(err, "Failed to connect to the %s repository", cfg.Storage.Provider))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to connect to the "+cfg.Storage.Provider.String()+" repository"))
|
||||
}
|
||||
|
||||
defer utils.CloseRepo(ctx, r)
|
||||
@ -151,16 +152,16 @@ func restoreExchangeCmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
ro, err := r.NewRestore(ctx, utils.BackupID, sel.Selector, dest)
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrap(err, "Failed to initialize Exchange restore"))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to initialize Exchange restore"))
|
||||
}
|
||||
|
||||
ds, err := ro.Run(ctx)
|
||||
if err != nil {
|
||||
if errors.Is(err, data.ErrNotFound) {
|
||||
return Only(ctx, errors.Errorf("Backup or backup details missing for id %s", utils.BackupID))
|
||||
return Only(ctx, clues.New("Backup or backup details missing for id "+utils.BackupID))
|
||||
}
|
||||
|
||||
return Only(ctx, errors.Wrap(err, "Failed to run Exchange restore"))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to run Exchange restore"))
|
||||
}
|
||||
|
||||
ds.PrintEntries(ctx)
|
||||
|
||||
@ -4,11 +4,11 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/cli"
|
||||
"github.com/alcionai/corso/src/cli/config"
|
||||
"github.com/alcionai/corso/src/cli/utils"
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package restore
|
||||
|
||||
import (
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
@ -103,7 +104,7 @@ func restoreOneDriveCmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
r, err := repository.Connect(ctx, cfg.Account, cfg.Storage, options.Control())
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrapf(err, "Failed to connect to the %s repository", cfg.Storage.Provider))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to connect to the "+cfg.Storage.Provider.String()+" repository"))
|
||||
}
|
||||
|
||||
defer utils.CloseRepo(ctx, r)
|
||||
@ -116,16 +117,16 @@ func restoreOneDriveCmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
ro, err := r.NewRestore(ctx, utils.BackupID, sel.Selector, dest)
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrap(err, "Failed to initialize OneDrive restore"))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to initialize OneDrive restore"))
|
||||
}
|
||||
|
||||
ds, err := ro.Run(ctx)
|
||||
if err != nil {
|
||||
if errors.Is(err, data.ErrNotFound) {
|
||||
return Only(ctx, errors.Errorf("Backup or backup details missing for id %s", utils.BackupID))
|
||||
return Only(ctx, clues.New("Backup or backup details missing for id "+utils.BackupID))
|
||||
}
|
||||
|
||||
return Only(ctx, errors.Wrap(err, "Failed to run OneDrive restore"))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to run OneDrive restore"))
|
||||
}
|
||||
|
||||
ds.PrintEntries(ctx)
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package restore
|
||||
|
||||
import (
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
@ -117,7 +118,7 @@ func restoreSharePointCmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
r, err := repository.Connect(ctx, cfg.Account, cfg.Storage, options.Control())
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrapf(err, "Failed to connect to the %s repository", cfg.Storage.Provider))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to connect to the "+cfg.Storage.Provider.String()+" repository"))
|
||||
}
|
||||
|
||||
defer utils.CloseRepo(ctx, r)
|
||||
@ -130,16 +131,16 @@ func restoreSharePointCmd(cmd *cobra.Command, args []string) error {
|
||||
|
||||
ro, err := r.NewRestore(ctx, utils.BackupID, sel.Selector, dest)
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrap(err, "Failed to initialize SharePoint restore"))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to initialize SharePoint restore"))
|
||||
}
|
||||
|
||||
ds, err := ro.Run(ctx)
|
||||
if err != nil {
|
||||
if errors.Is(err, data.ErrNotFound) {
|
||||
return Only(ctx, errors.Errorf("Backup or backup details missing for id %s", utils.BackupID))
|
||||
return Only(ctx, clues.New("Backup or backup details missing for id "+utils.BackupID))
|
||||
}
|
||||
|
||||
return Only(ctx, errors.Wrap(err, "Failed to run SharePoint restore"))
|
||||
return Only(ctx, clues.Wrap(err, "Failed to run SharePoint restore"))
|
||||
}
|
||||
|
||||
ds.PrintEntries(ctx)
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/alcionai/corso/src/pkg/selectors"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// flag names
|
||||
@ -197,27 +197,27 @@ func AddExchangeInfo(
|
||||
// ValidateExchangeRestoreFlags checks common flags for correctness and interdependencies
|
||||
func ValidateExchangeRestoreFlags(backupID string, opts ExchangeOpts) error {
|
||||
if len(backupID) == 0 {
|
||||
return errors.New("a backup ID is required")
|
||||
return clues.New("a backup ID is required")
|
||||
}
|
||||
|
||||
if _, ok := opts.Populated[EmailReceivedAfterFN]; ok && !IsValidTimeFormat(opts.EmailReceivedAfter) {
|
||||
return errors.New("invalid time format for email-received-after")
|
||||
return clues.New("invalid time format for email-received-after")
|
||||
}
|
||||
|
||||
if _, ok := opts.Populated[EmailReceivedBeforeFN]; ok && !IsValidTimeFormat(opts.EmailReceivedBefore) {
|
||||
return errors.New("invalid time format for email-received-before")
|
||||
return clues.New("invalid time format for email-received-before")
|
||||
}
|
||||
|
||||
if _, ok := opts.Populated[EventStartsAfterFN]; ok && !IsValidTimeFormat(opts.EventStartsAfter) {
|
||||
return errors.New("invalid time format for event-starts-after")
|
||||
return clues.New("invalid time format for event-starts-after")
|
||||
}
|
||||
|
||||
if _, ok := opts.Populated[EventStartsBeforeFN]; ok && !IsValidTimeFormat(opts.EventStartsBefore) {
|
||||
return errors.New("invalid time format for event-starts-before")
|
||||
return clues.New("invalid time format for event-starts-before")
|
||||
}
|
||||
|
||||
if _, ok := opts.Populated[EventRecursFN]; ok && !IsValidBool(opts.EventRecurs) {
|
||||
return errors.New("invalid format for event-recurs")
|
||||
return clues.New("invalid format for event-recurs")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@ -3,10 +3,10 @@ package utils_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/cli/utils"
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/alcionai/corso/src/pkg/selectors"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
type OneDriveOpts struct {
|
||||
@ -57,23 +57,23 @@ func AddOneDriveDetailsAndRestoreFlags(cmd *cobra.Command) {
|
||||
// ValidateOneDriveRestoreFlags checks common flags for correctness and interdependencies
|
||||
func ValidateOneDriveRestoreFlags(backupID string, opts OneDriveOpts) error {
|
||||
if len(backupID) == 0 {
|
||||
return errors.New("a backup ID is required")
|
||||
return clues.New("a backup ID is required")
|
||||
}
|
||||
|
||||
if _, ok := opts.Populated[FileCreatedAfterFN]; ok && !IsValidTimeFormat(opts.FileCreatedAfter) {
|
||||
return errors.New("invalid time format for created-after")
|
||||
return clues.New("invalid time format for created-after")
|
||||
}
|
||||
|
||||
if _, ok := opts.Populated[FileCreatedBeforeFN]; ok && !IsValidTimeFormat(opts.FileCreatedBefore) {
|
||||
return errors.New("invalid time format for created-before")
|
||||
return clues.New("invalid time format for created-before")
|
||||
}
|
||||
|
||||
if _, ok := opts.Populated[FileModifiedAfterFN]; ok && !IsValidTimeFormat(opts.FileModifiedAfter) {
|
||||
return errors.New("invalid time format for modified-after")
|
||||
return clues.New("invalid time format for modified-after")
|
||||
}
|
||||
|
||||
if _, ok := opts.Populated[FileModifiedBeforeFN]; ok && !IsValidTimeFormat(opts.FileModifiedBefore) {
|
||||
return errors.New("invalid time format for modified-before")
|
||||
return clues.New("invalid time format for modified-before")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/alcionai/corso/src/pkg/selectors"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -97,23 +97,23 @@ func AddSharePointDetailsAndRestoreFlags(cmd *cobra.Command) {
|
||||
// ValidateSharePointRestoreFlags checks common flags for correctness and interdependencies
|
||||
func ValidateSharePointRestoreFlags(backupID string, opts SharePointOpts) error {
|
||||
if len(backupID) == 0 {
|
||||
return errors.New("a backup ID is required")
|
||||
return clues.New("a backup ID is required")
|
||||
}
|
||||
|
||||
if _, ok := opts.Populated[FileCreatedAfterFN]; ok && !IsValidTimeFormat(opts.FileCreatedAfter) {
|
||||
return errors.New("invalid time format for " + FileCreatedAfterFN)
|
||||
return clues.New("invalid time format for " + FileCreatedAfterFN)
|
||||
}
|
||||
|
||||
if _, ok := opts.Populated[FileCreatedBeforeFN]; ok && !IsValidTimeFormat(opts.FileCreatedBefore) {
|
||||
return errors.New("invalid time format for " + FileCreatedBeforeFN)
|
||||
return clues.New("invalid time format for " + FileCreatedBeforeFN)
|
||||
}
|
||||
|
||||
if _, ok := opts.Populated[FileModifiedAfterFN]; ok && !IsValidTimeFormat(opts.FileModifiedAfter) {
|
||||
return errors.New("invalid time format for " + FileModifiedAfterFN)
|
||||
return clues.New("invalid time format for " + FileModifiedAfterFN)
|
||||
}
|
||||
|
||||
if _, ok := opts.Populated[FileModifiedBeforeFN]; ok && !IsValidTimeFormat(opts.FileModifiedBefore) {
|
||||
return errors.New("invalid time format for " + FileModifiedBeforeFN)
|
||||
return clues.New("invalid time format for " + FileModifiedBeforeFN)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
13
src/cli/utils/testdata/opts.go
vendored
13
src/cli/utils/testdata/opts.go
vendored
@ -2,9 +2,10 @@ package testdata
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
|
||||
"github.com/alcionai/corso/src/cli/utils"
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
"github.com/alcionai/corso/src/internal/model"
|
||||
@ -560,21 +561,21 @@ func (MockBackupGetter) Backup(
|
||||
context.Context,
|
||||
model.StableID,
|
||||
) (*backup.Backup, error) {
|
||||
return nil, errors.New("unexpected call to mock")
|
||||
return nil, clues.New("unexpected call to mock")
|
||||
}
|
||||
|
||||
func (MockBackupGetter) Backups(
|
||||
context.Context,
|
||||
[]model.StableID,
|
||||
) ([]*backup.Backup, *fault.Bus) {
|
||||
return nil, fault.New(false).Fail(errors.New("unexpected call to mock"))
|
||||
return nil, fault.New(false).Fail(clues.New("unexpected call to mock"))
|
||||
}
|
||||
|
||||
func (MockBackupGetter) BackupsByTag(
|
||||
context.Context,
|
||||
...store.FilterOption,
|
||||
) ([]*backup.Backup, error) {
|
||||
return nil, errors.New("unexpected call to mock")
|
||||
return nil, clues.New("unexpected call to mock")
|
||||
}
|
||||
|
||||
func (bg *MockBackupGetter) GetBackupDetails(
|
||||
@ -585,7 +586,7 @@ func (bg *MockBackupGetter) GetBackupDetails(
|
||||
return testdata.GetDetailsSet(), nil, fault.New(true)
|
||||
}
|
||||
|
||||
return nil, nil, fault.New(false).Fail(errors.New("unexpected call to mock"))
|
||||
return nil, nil, fault.New(false).Fail(clues.New("unexpected call to mock"))
|
||||
}
|
||||
|
||||
func (bg *MockBackupGetter) GetBackupErrors(
|
||||
@ -597,5 +598,5 @@ func (bg *MockBackupGetter) GetBackupErrors(
|
||||
return &fe, nil, fault.New(true)
|
||||
}
|
||||
|
||||
return nil, nil, fault.New(false).Fail(errors.New("unexpected call to mock"))
|
||||
return nil, nil, fault.New(false).Fail(clues.New("unexpected call to mock"))
|
||||
}
|
||||
|
||||
@ -2,9 +2,9 @@ package utils
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
@ -26,7 +26,7 @@ const (
|
||||
func RequireProps(props map[string]string) error {
|
||||
for name, val := range props {
|
||||
if len(val) == 0 {
|
||||
return errors.New(name + " is required to perform this command")
|
||||
return clues.New(name + " is required to perform this command")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,10 +3,10 @@ package utils
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/pkg/selectors"
|
||||
)
|
||||
|
||||
@ -8,7 +8,6 @@ import (
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/cli/print"
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
@ -34,9 +33,9 @@ var (
|
||||
User string
|
||||
)
|
||||
|
||||
// TODO: ErrGenerating = errors.New("not all items were successfully generated")
|
||||
// TODO: ErrGenerating = clues.New("not all items were successfully generated")
|
||||
|
||||
var ErrNotYetImplemeted = errors.New("not yet implemented")
|
||||
var ErrNotYetImplemeted = clues.New("not yet implemented")
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// Restoration
|
||||
@ -115,7 +114,7 @@ func getGCAndVerifyUser(ctx context.Context, userID string) (*connector.GraphCon
|
||||
|
||||
acct, err := account.NewAccount(account.ProviderM365, m365Cfg)
|
||||
if err != nil {
|
||||
return nil, account.Account{}, errors.Wrap(err, "finding m365 account details")
|
||||
return nil, account.Account{}, clues.Wrap(err, "finding m365 account details")
|
||||
}
|
||||
|
||||
// build a graph connector
|
||||
@ -133,7 +132,7 @@ func getGCAndVerifyUser(ctx context.Context, userID string) (*connector.GraphCon
|
||||
}
|
||||
|
||||
if _, ok := normUsers[strings.ToLower(User)]; !ok {
|
||||
return nil, account.Account{}, errors.New("user not found within tenant")
|
||||
return nil, account.Account{}, clues.New("user not found within tenant")
|
||||
}
|
||||
|
||||
gc, err := connector.NewGraphConnector(
|
||||
@ -143,7 +142,7 @@ func getGCAndVerifyUser(ctx context.Context, userID string) (*connector.GraphCon
|
||||
connector.Users,
|
||||
errs)
|
||||
if err != nil {
|
||||
return nil, account.Account{}, errors.Wrap(err, "connecting to graph api")
|
||||
return nil, account.Account{}, clues.Wrap(err, "connecting to graph api")
|
||||
}
|
||||
|
||||
return gc, acct, nil
|
||||
|
||||
@ -9,9 +9,9 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoft/kiota-abstractions-go/serialization"
|
||||
kw "github.com/microsoft/kiota-serialization-json-go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
. "github.com/alcionai/corso/src/cli/print"
|
||||
@ -83,7 +83,7 @@ func handleGetCommand(cmd *cobra.Command, args []string) error {
|
||||
|
||||
err = runDisplayM365JSON(ctx, creds, user, m365ID, fault.New(true))
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrapf(err, "unable to create mock from M365: %s", m365ID))
|
||||
return Only(ctx, clues.Wrap(err, "Error displaying item: "+m365ID))
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -126,12 +126,12 @@ func runDisplayM365JSON(
|
||||
|
||||
err = sw.WriteStringValue("", &str)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "unable to %s to string value", itemID)
|
||||
return clues.Wrap(err, "Error writing string value: "+itemID)
|
||||
}
|
||||
|
||||
array, err := sw.GetSerializedContent()
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "unable to serialize new value from M365:%s", itemID)
|
||||
return clues.Wrap(err, "Error serializing item: "+itemID)
|
||||
}
|
||||
|
||||
fmt.Println(string(array))
|
||||
@ -160,7 +160,7 @@ func getItem(
|
||||
) ([]byte, error) {
|
||||
sp, _, err := itm.GetItem(ctx, user, itemID, errs)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "getting item")
|
||||
return nil, clues.Wrap(err, "getting item")
|
||||
}
|
||||
|
||||
return itm.Serialize(ctx, sp, user, itemID)
|
||||
@ -179,7 +179,7 @@ func getGC(ctx context.Context) (*connector.GraphConnector, account.M365Config,
|
||||
|
||||
acct, err := account.NewAccount(account.ProviderM365, m365Cfg)
|
||||
if err != nil {
|
||||
return nil, m365Cfg, Only(ctx, errors.Wrap(err, "finding m365 account details"))
|
||||
return nil, m365Cfg, Only(ctx, clues.Wrap(err, "finding m365 account details"))
|
||||
}
|
||||
|
||||
// TODO: log/print recoverable errors
|
||||
@ -187,7 +187,7 @@ func getGC(ctx context.Context) (*connector.GraphConnector, account.M365Config,
|
||||
|
||||
gc, err := connector.NewGraphConnector(ctx, graph.HTTPClient(graph.NoTimeout()), acct, connector.Users, errs)
|
||||
if err != nil {
|
||||
return nil, m365Cfg, Only(ctx, errors.Wrap(err, "connecting to graph API"))
|
||||
return nil, m365Cfg, Only(ctx, clues.Wrap(err, "connecting to graph API"))
|
||||
}
|
||||
|
||||
return gc, m365Cfg, nil
|
||||
|
||||
@ -8,6 +8,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
@ -45,35 +46,35 @@ func main() {
|
||||
|
||||
func genDocs(cmd *cobra.Command, args []string) {
|
||||
if err := makeDir(cliMarkdownDir); err != nil {
|
||||
fatal(errors.Wrap(err, "preparing directory for markdown generation"))
|
||||
fatal(clues.Wrap(err, "preparing directory for markdown generation"))
|
||||
}
|
||||
|
||||
corsoCmd := cli.CorsoCommand()
|
||||
|
||||
err := genMarkdownCorso(corsoCmd, cliMarkdownDir)
|
||||
if err != nil {
|
||||
fatal(errors.Wrap(err, "generating the Corso CLI markdown"))
|
||||
fatal(clues.Wrap(err, "generating the Corso CLI markdown"))
|
||||
}
|
||||
}
|
||||
|
||||
func makeDir(dir string) error {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "finding current working directory")
|
||||
return clues.Wrap(err, "finding current working directory")
|
||||
}
|
||||
|
||||
if !strings.HasSuffix(wd, "/src") {
|
||||
return errors.New("must be called from /corso/src")
|
||||
return clues.New("must be called from /corso/src")
|
||||
}
|
||||
|
||||
_, err = os.Stat(dir)
|
||||
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
return errors.Wrap(err, "unable to discover directory")
|
||||
return clues.Wrap(err, "unable to discover directory")
|
||||
}
|
||||
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
if err := os.Mkdir(dir, os.ModePerm); err != nil {
|
||||
return errors.Wrap(err, "generating directory to hold markdown")
|
||||
return clues.Wrap(err, "generating directory to hold markdown")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,10 +6,10 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
. "github.com/alcionai/corso/src/cli/print"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
. "github.com/alcionai/corso/src/cli/print"
|
||||
"github.com/alcionai/corso/src/cli/utils"
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
"github.com/alcionai/corso/src/internal/connector"
|
||||
@ -41,7 +41,7 @@ var (
|
||||
prefix string
|
||||
)
|
||||
|
||||
var ErrPurging = errors.New("not all items were successfully purged")
|
||||
var ErrPurging = clues.New("not all items were successfully purged")
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// CLI command handlers
|
||||
@ -109,7 +109,7 @@ func handleOneDriveFolderPurge(cmd *cobra.Command, args []string) error {
|
||||
|
||||
if err := runPurgeForEachUser(ctx, acct, gc, t, purgeOneDriveFolders); err != nil {
|
||||
logger.Ctx(ctx).Error(err)
|
||||
return Only(ctx, errors.Wrap(ErrPurging, "OneDrive folders"))
|
||||
return Only(ctx, clues.Wrap(ErrPurging, "OneDrive folders"))
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -182,7 +182,7 @@ func purgeOneDriveFolders(
|
||||
deleter := func(gs graph.Servicer, uid string, f purgable) error {
|
||||
driveFolder, ok := f.(*onedrive.Displayable)
|
||||
if !ok {
|
||||
return errors.New("non-OneDrive item")
|
||||
return clues.New("non-OneDrive item")
|
||||
}
|
||||
|
||||
return onedrive.DeleteItem(
|
||||
@ -211,7 +211,7 @@ func purgeFolders(
|
||||
// get them folders
|
||||
fs, err := getter(gc.Service, uid, prefix)
|
||||
if err != nil {
|
||||
return Only(ctx, errors.Wrapf(err, "retrieving %s folders", data))
|
||||
return Only(ctx, clues.Wrap(err, "retrieving folders: "+data))
|
||||
}
|
||||
|
||||
if len(fs) == 0 {
|
||||
@ -228,7 +228,7 @@ func purgeFolders(
|
||||
|
||||
dnTime, err := common.ExtractTime(displayName)
|
||||
if err != nil && !errors.Is(err, common.ErrNoTimeString) {
|
||||
err = errors.Wrapf(err, "!! Error: parsing container named [%s]", displayName)
|
||||
err = clues.Wrap(err, "!! Error: parsing container: "+displayName)
|
||||
Info(ctx, err)
|
||||
|
||||
return err
|
||||
@ -242,7 +242,7 @@ func purgeFolders(
|
||||
|
||||
err = deleter(gc.Service, uid, fld)
|
||||
if err != nil {
|
||||
err = errors.Wrapf(err, "!! Error")
|
||||
err = clues.Wrap(err, "!! Error")
|
||||
Info(ctx, err)
|
||||
}
|
||||
}
|
||||
@ -263,7 +263,7 @@ func getGC(ctx context.Context) (account.Account, *connector.GraphConnector, err
|
||||
|
||||
acct, err := account.NewAccount(account.ProviderM365, m365Cfg)
|
||||
if err != nil {
|
||||
return account.Account{}, nil, Only(ctx, errors.Wrap(err, "finding m365 account details"))
|
||||
return account.Account{}, nil, Only(ctx, clues.Wrap(err, "finding m365 account details"))
|
||||
}
|
||||
|
||||
// build a graph connector
|
||||
@ -272,7 +272,7 @@ func getGC(ctx context.Context) (account.Account, *connector.GraphConnector, err
|
||||
|
||||
gc, err := connector.NewGraphConnector(ctx, graph.HTTPClient(graph.NoTimeout()), acct, connector.Users, errs)
|
||||
if err != nil {
|
||||
return account.Account{}, nil, Only(ctx, errors.Wrap(err, "connecting to graph api"))
|
||||
return account.Account{}, nil, Only(ctx, clues.Wrap(err, "connecting to graph api"))
|
||||
}
|
||||
|
||||
return acct, gc, nil
|
||||
@ -288,7 +288,7 @@ func getBoundaryTime(ctx context.Context) (time.Time, error) {
|
||||
if len(before) > 0 {
|
||||
boundaryTime, err = common.ParseTime(before)
|
||||
if err != nil {
|
||||
return time.Time{}, Only(ctx, errors.Wrap(err, "parsing before flag to time"))
|
||||
return time.Time{}, Only(ctx, clues.Wrap(err, "parsing before flag to time"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,10 +3,10 @@ package common_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
)
|
||||
|
||||
@ -4,10 +4,11 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common/crash"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/crash"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
)
|
||||
|
||||
type CrashTestDummySuite struct {
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type TimeFormat string
|
||||
@ -87,8 +86,8 @@ var (
|
||||
)
|
||||
|
||||
var (
|
||||
ErrNoTimeString = errors.New("no substring contains a known time format")
|
||||
errParsingStringToTime = errors.New("parsing string as time.Time")
|
||||
ErrNoTimeString = clues.New("no substring contains a known time format")
|
||||
errParsingStringToTime = clues.New("parsing string as time.Time")
|
||||
)
|
||||
|
||||
// Now produces the current time as a string in the standard format.
|
||||
@ -136,7 +135,7 @@ func FormatLegacyTime(t time.Time) string {
|
||||
// the provided string. Always returns a UTC timezone value.
|
||||
func ParseTime(s string) (time.Time, error) {
|
||||
if len(s) == 0 {
|
||||
return time.Time{}, clues.Stack(errParsingStringToTime, errors.New("empty string"))
|
||||
return time.Time{}, clues.Stack(errParsingStringToTime, clues.New("empty string"))
|
||||
}
|
||||
|
||||
for _, form := range formats {
|
||||
@ -146,14 +145,14 @@ func ParseTime(s string) (time.Time, error) {
|
||||
}
|
||||
}
|
||||
|
||||
return time.Time{}, clues.Stack(errParsingStringToTime, errors.New(s))
|
||||
return time.Time{}, clues.Stack(errParsingStringToTime, clues.New(s))
|
||||
}
|
||||
|
||||
// ExtractTime greedily retrieves a timestamp substring from the provided string.
|
||||
// returns ErrNoTimeString if no match is found.
|
||||
func ExtractTime(s string) (time.Time, error) {
|
||||
if len(s) == 0 {
|
||||
return time.Time{}, clues.Stack(errParsingStringToTime, errors.New("empty string"))
|
||||
return time.Time{}, clues.Stack(errParsingStringToTime, clues.New("empty string"))
|
||||
}
|
||||
|
||||
for _, re := range regexes {
|
||||
@ -163,5 +162,5 @@ func ExtractTime(s string) (time.Time, error) {
|
||||
}
|
||||
}
|
||||
|
||||
return time.Time{}, clues.Stack(ErrNoTimeString, errors.New(s))
|
||||
return time.Time{}, clues.Stack(ErrNoTimeString, clues.New(s))
|
||||
}
|
||||
|
||||
@ -4,11 +4,11 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
)
|
||||
|
||||
@ -4,9 +4,8 @@ import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/connector/discovery"
|
||||
"github.com/alcionai/corso/src/internal/connector/discovery/api"
|
||||
"github.com/alcionai/corso/src/internal/connector/exchange"
|
||||
@ -212,7 +211,7 @@ func (gc *GraphConnector) RestoreDataCollections(
|
||||
|
||||
creds, err := acct.M365Config()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "malformed azure credentials")
|
||||
return nil, clues.Wrap(err, "malformed azure credentials")
|
||||
}
|
||||
|
||||
switch selector.Service {
|
||||
|
||||
@ -5,11 +5,11 @@ import (
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/exchange"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/connector/sharepoint"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/alcionai/clues"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/pkg/account"
|
||||
@ -49,7 +49,7 @@ func newService(creds account.M365Config) (*graph.Service, error) {
|
||||
creds.AzureClientID,
|
||||
creds.AzureClientSecret)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "generating graph api service client")
|
||||
return nil, clues.Wrap(err, "generating graph api service client")
|
||||
}
|
||||
|
||||
return graph.NewService(adapter), nil
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/alcionai/clues"
|
||||
absser "github.com/microsoft/kiota-abstractions-go/serialization"
|
||||
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/connector/graph/betasdk"
|
||||
)
|
||||
@ -32,12 +32,12 @@ func (s BetaService) Serialize(object absser.Parsable) ([]byte, error) {
|
||||
GetSerializationWriterFactory().
|
||||
GetSerializationWriter("application/json")
|
||||
if err != nil || writer == nil {
|
||||
return nil, errors.Wrap(err, "creating json serialization writer")
|
||||
return nil, clues.Wrap(err, "creating json serialization writer")
|
||||
}
|
||||
|
||||
err = writer.WriteObjectValue("", object)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "writeObjecValue serialization")
|
||||
return nil, clues.Wrap(err, "writeObjecValue serialization")
|
||||
}
|
||||
|
||||
return writer.GetSerializedContent()
|
||||
|
||||
@ -3,11 +3,11 @@ package api
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph/betasdk/models"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
|
||||
@ -2,13 +2,13 @@ package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
absser "github.com/microsoft/kiota-abstractions-go"
|
||||
msgraphgocore "github.com/microsoftgraph/msgraph-sdk-go-core"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/users"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
@ -182,7 +182,7 @@ func (c Users) GetInfo(ctx context.Context, userID string) (*UserInfo, error) {
|
||||
func validateUser(item any) (models.Userable, error) {
|
||||
m, ok := item.(models.Userable)
|
||||
if !ok {
|
||||
return nil, clues.Stack(clues.New("unexpected model"), errors.Errorf("%T", item))
|
||||
return nil, clues.New(fmt.Sprintf("unexpected model: %T", item))
|
||||
}
|
||||
|
||||
if m.GetId() == nil {
|
||||
|
||||
@ -3,11 +3,11 @@ package api
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
)
|
||||
|
||||
|
||||
@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/connector/discovery/api"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
@ -61,12 +60,12 @@ func User(ctx context.Context, gwi getWithInfoer, userID string) (models.Userabl
|
||||
return nil, nil, fmt.Errorf("resource owner [%s] not found within tenant", userID)
|
||||
}
|
||||
|
||||
return nil, nil, errors.Wrap(err, "getting user")
|
||||
return nil, nil, clues.Wrap(err, "getting user")
|
||||
}
|
||||
|
||||
ui, err := gwi.GetInfo(ctx, userID)
|
||||
if err != nil {
|
||||
return nil, nil, errors.Wrap(err, "getting user info")
|
||||
return nil, nil, clues.Wrap(err, "getting user info")
|
||||
}
|
||||
|
||||
return u, ui, nil
|
||||
|
||||
@ -3,11 +3,11 @@ package discovery_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/discovery"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/pkg/account"
|
||||
|
||||
@ -7,7 +7,6 @@ import (
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoft/kiota-abstractions-go/serialization"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
@ -95,7 +94,7 @@ func newService(creds account.M365Config) (*graph.Service, error) {
|
||||
creds.AzureClientID,
|
||||
creds.AzureClientSecret)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "generating no-timeout graph adapter")
|
||||
return nil, clues.Wrap(err, "generating no-timeout graph adapter")
|
||||
}
|
||||
|
||||
return graph.NewService(a), nil
|
||||
@ -108,7 +107,7 @@ func newLargeItemService(creds account.M365Config) (*graph.Service, error) {
|
||||
creds.AzureClientSecret,
|
||||
graph.NoTimeout())
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "generating no-timeout graph adapter")
|
||||
return nil, clues.Wrap(err, "generating no-timeout graph adapter")
|
||||
}
|
||||
|
||||
return graph.NewService(a), nil
|
||||
@ -123,7 +122,7 @@ func newLargeItemService(creds account.M365Config) (*graph.Service, error) {
|
||||
func checkIDAndName(c graph.Container) error {
|
||||
id := ptr.Val(c.GetId())
|
||||
if len(id) == 0 {
|
||||
return errors.New("container missing ID")
|
||||
return clues.New("container missing ID")
|
||||
}
|
||||
|
||||
dn := ptr.Val(c.GetDisplayName())
|
||||
|
||||
@ -3,12 +3,12 @@ package api
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
||||
"github.com/alcionai/corso/src/internal/connector/support"
|
||||
|
||||
@ -4,12 +4,12 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
||||
"github.com/alcionai/corso/src/internal/connector/support"
|
||||
|
||||
@ -5,9 +5,9 @@ import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/support"
|
||||
"github.com/alcionai/corso/src/internal/connector/uploadsession"
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
)
|
||||
@ -13,7 +12,7 @@ import (
|
||||
func checkIDAndName(c graph.Container) error {
|
||||
id, ok := ptr.ValOK(c.GetId())
|
||||
if !ok {
|
||||
return errors.New("container missing ID")
|
||||
return clues.New("container missing ID")
|
||||
}
|
||||
|
||||
if _, ok := ptr.ValOK(c.GetDisplayName()); !ok {
|
||||
|
||||
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
@ -52,16 +51,16 @@ func (cfc *contactFolderCache) Populate(
|
||||
baseContainerPather ...string,
|
||||
) error {
|
||||
if err := cfc.init(ctx, baseID, baseContainerPather); err != nil {
|
||||
return errors.Wrap(err, "initializing")
|
||||
return clues.Wrap(err, "initializing")
|
||||
}
|
||||
|
||||
err := cfc.enumer.EnumerateContainers(ctx, cfc.userID, baseID, cfc.addFolder, errs)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "enumerating containers")
|
||||
return clues.Wrap(err, "enumerating containers")
|
||||
}
|
||||
|
||||
if err := cfc.populatePaths(ctx, false, errs); err != nil {
|
||||
return errors.Wrap(err, "populating paths")
|
||||
return clues.Wrap(err, "populating paths")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
@ -87,7 +86,7 @@ func (cr *containerResolver) idToPath(
|
||||
depth+1,
|
||||
useIDInPath)
|
||||
if err != nil {
|
||||
return nil, nil, errors.Wrap(err, "retrieving parent folder")
|
||||
return nil, nil, clues.Wrap(err, "retrieving parent folder")
|
||||
}
|
||||
|
||||
toAppend := ptr.Val(c.GetDisplayName())
|
||||
@ -135,11 +134,11 @@ func (cr *containerResolver) addFolder(cf graph.CacheFolder) error {
|
||||
// Only require a non-nil non-empty parent if the path isn't already populated.
|
||||
if cf.Path() != nil {
|
||||
if err := checkIDAndName(cf.Container); err != nil {
|
||||
return errors.Wrap(err, "adding item to cache")
|
||||
return clues.Wrap(err, "adding item to cache")
|
||||
}
|
||||
} else {
|
||||
if err := checkRequiredValues(cf.Container); err != nil {
|
||||
return errors.Wrap(err, "adding item to cache")
|
||||
return clues.Wrap(err, "adding item to cache")
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,7 +179,7 @@ func (cr *containerResolver) AddToCache(
|
||||
// when they're made.
|
||||
_, _, err := cr.IDToPath(ctx, ptr.Val(f.GetId()), useIDInPath)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "adding cache entry")
|
||||
return clues.Wrap(err, "adding cache entry")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@ -5,12 +5,12 @@ import (
|
||||
stdpath "path"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/connector/exchange/api"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
@ -286,7 +285,7 @@ func createCollections(
|
||||
|
||||
resolver, err := PopulateExchangeContainerResolver(ctx, qp, errs)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "populating container cache")
|
||||
return nil, clues.Wrap(err, "populating container cache")
|
||||
}
|
||||
|
||||
err = filterContainersAndFillCollections(
|
||||
@ -301,7 +300,7 @@ func createCollections(
|
||||
ctrlOpts,
|
||||
errs)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "filling collections")
|
||||
return nil, clues.Wrap(err, "filling collections")
|
||||
}
|
||||
|
||||
foldersComplete <- struct{}{}
|
||||
|
||||
@ -5,11 +5,11 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/exchange/api"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
|
||||
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
@ -44,7 +43,7 @@ func (ecc *eventCalendarCache) populateEventRoot(ctx context.Context) error {
|
||||
|
||||
f, err := ecc.getter.GetContainerByID(ctx, ecc.userID, container)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "fetching calendar")
|
||||
return clues.Wrap(err, "fetching calendar")
|
||||
}
|
||||
|
||||
temp := graph.NewCacheFolder(
|
||||
@ -68,7 +67,7 @@ func (ecc *eventCalendarCache) Populate(
|
||||
baseContainerPath ...string,
|
||||
) error {
|
||||
if err := ecc.init(ctx); err != nil {
|
||||
return errors.Wrap(err, "initializing")
|
||||
return clues.Wrap(err, "initializing")
|
||||
}
|
||||
|
||||
err := ecc.enumer.EnumerateContainers(
|
||||
@ -78,11 +77,11 @@ func (ecc *eventCalendarCache) Populate(
|
||||
ecc.addFolder,
|
||||
errs)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "enumerating containers")
|
||||
return clues.Wrap(err, "enumerating containers")
|
||||
}
|
||||
|
||||
if err := ecc.populatePaths(ctx, true, errs); err != nil {
|
||||
return errors.Wrap(err, "establishing calendar paths")
|
||||
return clues.Wrap(err, "establishing calendar paths")
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -116,7 +115,7 @@ func (ecc *eventCalendarCache) AddToCache(ctx context.Context, f graph.Container
|
||||
_, _, err := ecc.IDToPath(ctx, ptr.Val(f.GetId()), true)
|
||||
if err != nil {
|
||||
delete(ecc.newAdditions, ptr.Val(f.GetDisplayName()))
|
||||
return errors.Wrap(err, "setting path to container id")
|
||||
return clues.Wrap(err, "setting path to container id")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@ -5,12 +5,12 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoft/kiota-abstractions-go/serialization"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
|
||||
@ -3,11 +3,11 @@ package exchange
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/exchange/api"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
|
||||
@ -3,11 +3,11 @@ package exchange
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
||||
"github.com/alcionai/corso/src/internal/connector/support"
|
||||
|
||||
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
@ -72,16 +71,16 @@ func (mc *mailFolderCache) Populate(
|
||||
baseContainerPath ...string,
|
||||
) error {
|
||||
if err := mc.init(ctx); err != nil {
|
||||
return errors.Wrap(err, "initializing")
|
||||
return clues.Wrap(err, "initializing")
|
||||
}
|
||||
|
||||
err := mc.enumer.EnumerateContainers(ctx, mc.userID, "", mc.addFolder, errs)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "enumerating containers")
|
||||
return clues.Wrap(err, "enumerating containers")
|
||||
}
|
||||
|
||||
if err := mc.populatePaths(ctx, false, errs); err != nil {
|
||||
return errors.Wrap(err, "populating paths")
|
||||
return clues.Wrap(err, "populating paths")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@ -4,11 +4,11 @@ import (
|
||||
stdpath "path"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/exchange/api"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/pkg/account"
|
||||
|
||||
@ -5,11 +5,11 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/exchange/api"
|
||||
|
||||
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/exchange/api"
|
||||
@ -15,7 +14,7 @@ import (
|
||||
"github.com/alcionai/corso/src/pkg/selectors"
|
||||
)
|
||||
|
||||
var ErrFolderNotFound = errors.New("folder not found")
|
||||
var ErrFolderNotFound = clues.New("folder not found")
|
||||
|
||||
func createService(credentials account.M365Config) (*graph.Service, error) {
|
||||
adapter, err := graph.CreateAdapter(
|
||||
@ -23,7 +22,7 @@ func createService(credentials account.M365Config) (*graph.Service, error) {
|
||||
credentials.AzureClientID,
|
||||
credentials.AzureClientSecret)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "creating microsoft graph service for exchange")
|
||||
return nil, clues.Wrap(err, "creating microsoft graph service for exchange")
|
||||
}
|
||||
|
||||
return graph.NewService(adapter), nil
|
||||
|
||||
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/exchange/api"
|
||||
@ -235,7 +234,7 @@ func makeTombstones(dps DeltaPaths) map[string]string {
|
||||
func pathFromPrevString(ps string) (path.Path, error) {
|
||||
p, err := path.FromDataLayerPath(ps, false)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "parsing previous path string")
|
||||
return nil, clues.Wrap(err, "parsing previous path string")
|
||||
}
|
||||
|
||||
return p, nil
|
||||
|
||||
@ -4,12 +4,11 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/exchange/api"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
@ -50,7 +49,7 @@ func (mg mockGetter) GetAddedAndRemovedItemIDs(
|
||||
) {
|
||||
results, ok := mg[cID]
|
||||
if !ok {
|
||||
return nil, nil, api.DeltaUpdate{}, errors.New("mock not found for " + cID)
|
||||
return nil, nil, api.DeltaUpdate{}, clues.New("mock not found for " + cID)
|
||||
}
|
||||
|
||||
return results.added, results.removed, results.newDelta, results.err
|
||||
|
||||
@ -9,7 +9,6 @@ import (
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
@ -283,7 +282,7 @@ func SendMailToBackStore(
|
||||
continue
|
||||
}
|
||||
|
||||
el.AddRecoverable(errors.Wrap(err, "uploading mail attachment"))
|
||||
el.AddRecoverable(clues.Wrap(err, "uploading mail attachment"))
|
||||
|
||||
break
|
||||
}
|
||||
@ -622,7 +621,7 @@ func establishMailRestoreLocation(
|
||||
// call even if we make a new cache.
|
||||
if isNewCache {
|
||||
if err := mfc.Populate(ctx, errs, rootFolderAlias); err != nil {
|
||||
return "", errors.Wrap(err, "populating folder cache")
|
||||
return "", clues.Wrap(err, "populating folder cache")
|
||||
}
|
||||
|
||||
isNewCache = false
|
||||
@ -630,7 +629,7 @@ func establishMailRestoreLocation(
|
||||
|
||||
// NOOP if the folder is already in the cache.
|
||||
if err = mfc.AddToCache(ctx, temp, false); err != nil {
|
||||
return "", errors.Wrap(err, "adding folder to cache")
|
||||
return "", clues.Wrap(err, "adding folder to cache")
|
||||
}
|
||||
}
|
||||
|
||||
@ -668,11 +667,11 @@ func establishContactsRestoreLocation(
|
||||
|
||||
if isNewCache {
|
||||
if err := cfc.Populate(ctx, errs, folderID, folders[0]); err != nil {
|
||||
return "", errors.Wrap(err, "populating contact cache")
|
||||
return "", clues.Wrap(err, "populating contact cache")
|
||||
}
|
||||
|
||||
if err = cfc.AddToCache(ctx, temp, false); err != nil {
|
||||
return "", errors.Wrap(err, "adding contact folder to cache")
|
||||
return "", clues.Wrap(err, "adding contact folder to cache")
|
||||
}
|
||||
}
|
||||
|
||||
@ -705,12 +704,12 @@ func establishEventsRestoreLocation(
|
||||
|
||||
if isNewCache {
|
||||
if err = ecc.Populate(ctx, errs, folderID, folders[0]); err != nil {
|
||||
return "", errors.Wrap(err, "populating event cache")
|
||||
return "", clues.Wrap(err, "populating event cache")
|
||||
}
|
||||
|
||||
displayable := api.CalendarDisplayable{Calendarable: temp}
|
||||
if err = ecc.AddToCache(ctx, displayable, true); err != nil {
|
||||
return "", errors.Wrap(err, "adding new calendar to cache")
|
||||
return "", clues.Wrap(err, "adding new calendar to cache")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
@ -175,7 +174,7 @@ func CreateCalendarDisplayable(entry any, parentID string) *CalendarDisplayable
|
||||
func CheckRequiredValues(c Container) error {
|
||||
id, ok := ptr.ValOK(c.GetId())
|
||||
if !ok {
|
||||
return errors.New("container missing ID")
|
||||
return clues.New("container missing ID")
|
||||
}
|
||||
|
||||
if _, ok := ptr.ValOK(c.GetDisplayName()); !ok {
|
||||
|
||||
@ -9,12 +9,12 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/exp/slices"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
"github.com/alcionai/corso/src/pkg/logger"
|
||||
|
||||
@ -5,12 +5,12 @@ import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
)
|
||||
|
||||
@ -4,11 +4,11 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph/metadata"
|
||||
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/alcionai/clues"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/connector/support"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
@ -42,18 +42,18 @@ func NewMetadataEntry(fileName string, mData any) MetadataCollectionEntry {
|
||||
|
||||
func (mce MetadataCollectionEntry) toMetadataItem() (MetadataItem, error) {
|
||||
if len(mce.fileName) == 0 {
|
||||
return MetadataItem{}, errors.New("missing metadata filename")
|
||||
return MetadataItem{}, clues.New("missing metadata filename")
|
||||
}
|
||||
|
||||
if mce.data == nil {
|
||||
return MetadataItem{}, errors.New("missing metadata")
|
||||
return MetadataItem{}, clues.New("missing metadata")
|
||||
}
|
||||
|
||||
buf := &bytes.Buffer{}
|
||||
encoder := json.NewEncoder(buf)
|
||||
|
||||
if err := encoder.Encode(mce.data); err != nil {
|
||||
return MetadataItem{}, errors.Wrap(err, "serializing metadata")
|
||||
return MetadataItem{}, clues.Wrap(err, "serializing metadata")
|
||||
}
|
||||
|
||||
return NewMetadataItem(mce.fileName, buf.Bytes()), nil
|
||||
@ -81,7 +81,7 @@ func MakeMetadataCollection(
|
||||
false,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "making metadata path")
|
||||
return nil, clues.Wrap(err, "making metadata path")
|
||||
}
|
||||
|
||||
items := make([]MetadataItem, 0, len(metadata))
|
||||
|
||||
@ -5,12 +5,12 @@ import (
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/support"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
|
||||
@ -10,16 +10,15 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
|
||||
"github.com/alcionai/clues"
|
||||
backoff "github.com/cenkalti/backoff/v4"
|
||||
"github.com/microsoft/kiota-abstractions-go/serialization"
|
||||
ka "github.com/microsoft/kiota-authentication-azure-go"
|
||||
khttp "github.com/microsoft/kiota-http-go"
|
||||
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
|
||||
msgraphgocore "github.com/microsoftgraph/msgraph-sdk-go-core"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/time/rate"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/pkg/account"
|
||||
"github.com/alcionai/corso/src/pkg/logger"
|
||||
"github.com/alcionai/corso/src/pkg/path"
|
||||
@ -81,12 +80,12 @@ func (s Service) Client() *msgraphsdk.GraphServiceClient {
|
||||
func (s Service) Serialize(object serialization.Parsable) ([]byte, error) {
|
||||
writer, err := s.adapter.GetSerializationWriterFactory().GetSerializationWriter("application/json")
|
||||
if err != nil || writer == nil {
|
||||
return nil, errors.Wrap(err, "creating json serialization writer")
|
||||
return nil, clues.Wrap(err, "creating json serialization writer")
|
||||
}
|
||||
|
||||
err = writer.WriteObjectValue("", object)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "serializing object")
|
||||
return nil, clues.Wrap(err, "serializing object")
|
||||
}
|
||||
|
||||
return writer.GetSerializedContent()
|
||||
@ -175,7 +174,7 @@ func CreateAdapter(
|
||||
// Client Provider: Uses Secret for access to tenant-level data
|
||||
cred, err := azidentity.NewClientSecretCredential(tenant, client, secret, nil)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "creating m365 client identity")
|
||||
return nil, clues.Wrap(err, "creating m365 client identity")
|
||||
}
|
||||
|
||||
auth, err := ka.NewAzureIdentityAuthenticationProviderWithScopes(
|
||||
@ -183,7 +182,7 @@ func CreateAdapter(
|
||||
[]string{"https://graph.microsoft.com/.default"},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "creating azure authentication")
|
||||
return nil, clues.Wrap(err, "creating azure authentication")
|
||||
}
|
||||
|
||||
httpClient := HTTPClient(opts...)
|
||||
|
||||
@ -5,12 +5,12 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/pkg/account"
|
||||
)
|
||||
|
||||
@ -93,7 +93,7 @@ func NewGraphConnector(
|
||||
|
||||
if r == AllResources || r == Sites {
|
||||
if err = gc.setTenantSites(ctx, errs); err != nil {
|
||||
return nil, errors.Wrap(err, "retrieveing tenant site list")
|
||||
return nil, clues.Wrap(err, "retrieveing tenant site list")
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ func (gc *GraphConnector) setTenantSites(ctx context.Context, errs *fault.Bus) e
|
||||
return nil
|
||||
}
|
||||
|
||||
var errKnownSkippableCase = errors.New("case is known and skippable")
|
||||
var errKnownSkippableCase = clues.New("case is known and skippable")
|
||||
|
||||
const personalSitePath = "sharepoint.com/personal/"
|
||||
|
||||
|
||||
@ -4,11 +4,11 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/connector/support"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
|
||||
@ -10,13 +10,13 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/exp/maps"
|
||||
"golang.org/x/exp/slices"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
||||
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
||||
|
||||
@ -8,12 +8,12 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
||||
|
||||
@ -5,12 +5,12 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
|
||||
@ -5,13 +5,13 @@ import (
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
kioser "github.com/microsoft/kiota-serialization-json-go"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
||||
"github.com/alcionai/corso/src/internal/connector/support"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
|
||||
@ -6,11 +6,11 @@ import (
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
kw "github.com/microsoft/kiota-serialization-json-go"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
"github.com/alcionai/corso/src/pkg/path"
|
||||
|
||||
@ -5,13 +5,12 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
absser "github.com/microsoft/kiota-abstractions-go/serialization"
|
||||
js "github.com/microsoft/kiota-serialization-json-go"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
)
|
||||
|
||||
@ -748,12 +747,12 @@ func serialize(t *testing.T, item absser.Parsable) []byte {
|
||||
func hydrateMessage(byteArray []byte) (models.Messageable, error) {
|
||||
parseNode, err := js.NewJsonParseNodeFactory().GetRootParseNode("application/json", byteArray)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "deserializing bytes into base m365 object")
|
||||
return nil, clues.Wrap(err, "deserializing bytes into base m365 object")
|
||||
}
|
||||
|
||||
anObject, err := parseNode.GetObjectValue(models.CreateMessageFromDiscriminatorValue)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "parsing m365 object factory")
|
||||
return nil, clues.Wrap(err, "parsing m365 object factory")
|
||||
}
|
||||
|
||||
message := anObject.(models.Messageable)
|
||||
|
||||
@ -3,11 +3,11 @@ package api_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/connector/onedrive/api"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
|
||||
@ -12,7 +12,6 @@ import (
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spatialcurrent/go-lazy/pkg/lazy"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
@ -329,7 +328,7 @@ func (oc *Collection) getDriveItemContent(
|
||||
// refresh that download url.
|
||||
di, diErr := oc.itemGetter(ctx, oc.service, oc.driveID, itemID)
|
||||
if diErr != nil {
|
||||
err = errors.Wrap(diErr, "retrieving expired item")
|
||||
err = clues.Wrap(diErr, "retrieving expired item")
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
@ -11,13 +11,13 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/connector/support"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
|
||||
@ -231,7 +231,7 @@ func deserializeMap[T any](reader io.ReadCloser, alreadyFound map[string]T) erro
|
||||
tmp := map[string]T{}
|
||||
|
||||
if err := json.NewDecoder(reader).Decode(&tmp); err != nil {
|
||||
return errors.Wrap(err, "deserializing file contents")
|
||||
return clues.Wrap(err, "deserializing file contents")
|
||||
}
|
||||
|
||||
var duplicate bool
|
||||
@ -853,7 +853,7 @@ func GetCanonicalPath(p, tenant, resourceOwner string, source driveSource) (path
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "converting to canonical path")
|
||||
return nil, clues.Wrap(err, "converting to canonical path")
|
||||
}
|
||||
|
||||
return result, nil
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/google/uuid"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors"
|
||||
@ -14,7 +15,6 @@ import (
|
||||
"github.com/stretchr/testify/suite"
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
gapi "github.com/alcionai/corso/src/internal/connector/graph/api"
|
||||
"github.com/alcionai/corso/src/internal/connector/onedrive/api"
|
||||
|
||||
@ -5,6 +5,8 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/connector/support"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
@ -13,7 +15,6 @@ import (
|
||||
"github.com/alcionai/corso/src/pkg/logger"
|
||||
"github.com/alcionai/corso/src/pkg/path"
|
||||
"github.com/alcionai/corso/src/pkg/selectors"
|
||||
"golang.org/x/exp/maps"
|
||||
)
|
||||
|
||||
type odFolderMatcher struct {
|
||||
|
||||
@ -8,7 +8,6 @@ import (
|
||||
"github.com/alcionai/clues"
|
||||
msdrive "github.com/microsoftgraph/msgraph-sdk-go/drive"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
@ -55,7 +54,7 @@ func PagerForSource(
|
||||
case SharePointSource:
|
||||
return api.NewSiteDrivePager(servicer, resourceOwner, fields), nil
|
||||
default:
|
||||
return nil, errors.Errorf("unrecognized drive data source")
|
||||
return nil, clues.New("unrecognized drive data source")
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,7 +285,7 @@ func GetAllFolders(
|
||||
) ([]*Displayable, error) {
|
||||
drives, err := api.GetAllDrives(ctx, pager, true, maxDrivesRetries)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "getting OneDrive folders")
|
||||
return nil, clues.Wrap(err, "getting OneDrive folders")
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
@ -11,7 +11,6 @@ import (
|
||||
"github.com/alcionai/clues"
|
||||
msdrives "github.com/microsoftgraph/msgraph-sdk-go/drives"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
@ -52,7 +51,7 @@ func sharePointItemReader(
|
||||
) (details.ItemInfo, io.ReadCloser, error) {
|
||||
resp, err := downloadItem(ctx, hc, item)
|
||||
if err != nil {
|
||||
return details.ItemInfo{}, nil, errors.Wrap(err, "downloading item")
|
||||
return details.ItemInfo{}, nil, clues.Wrap(err, "downloading item")
|
||||
}
|
||||
|
||||
dii := details.ItemInfo{
|
||||
@ -135,7 +134,7 @@ func oneDriveItemReader(
|
||||
if isFile {
|
||||
resp, err := downloadItem(ctx, hc, item)
|
||||
if err != nil {
|
||||
return details.ItemInfo{}, nil, errors.Wrap(err, "downloading item")
|
||||
return details.ItemInfo{}, nil, clues.Wrap(err, "downloading item")
|
||||
}
|
||||
|
||||
rc = resp.Body
|
||||
|
||||
@ -6,12 +6,12 @@ import (
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
|
||||
@ -6,7 +6,6 @@ import (
|
||||
"github.com/alcionai/clues"
|
||||
msdrive "github.com/microsoftgraph/msgraph-sdk-go/drive"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/exp/slices"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
@ -24,11 +23,11 @@ func getParentMetadata(
|
||||
if !ok {
|
||||
onedrivePath, err := path.ToOneDrivePath(parentPath)
|
||||
if err != nil {
|
||||
return Metadata{}, errors.Wrap(err, "invalid restore path")
|
||||
return Metadata{}, clues.Wrap(err, "invalid restore path")
|
||||
}
|
||||
|
||||
if len(onedrivePath.Folders) != 0 {
|
||||
return Metadata{}, errors.Wrap(err, "computing item permissions")
|
||||
return Metadata{}, clues.Wrap(err, "computing item permissions")
|
||||
}
|
||||
|
||||
parentMeta = Metadata{}
|
||||
|
||||
@ -4,12 +4,13 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/internal/version"
|
||||
"github.com/alcionai/corso/src/pkg/path"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/internal/version"
|
||||
"github.com/alcionai/corso/src/pkg/path"
|
||||
)
|
||||
|
||||
type RestoreUnitSuite struct {
|
||||
|
||||
@ -3,10 +3,10 @@ package onedrive
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/connector/support"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
|
||||
@ -3,9 +3,9 @@ package api_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
discover "github.com/alcionai/corso/src/internal/connector/discovery/api"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/pkg/account"
|
||||
|
||||
@ -6,9 +6,10 @@ import (
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
msmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
mssites "github.com/microsoftgraph/msgraph-sdk-go/sites"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
discover "github.com/alcionai/corso/src/internal/connector/discovery/api"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
@ -19,8 +20,6 @@ import (
|
||||
D "github.com/alcionai/corso/src/internal/diagnostics"
|
||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
msmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
mssites "github.com/microsoftgraph/msgraph-sdk-go/sites"
|
||||
)
|
||||
|
||||
// GetSitePages retrieves a collection of Pages related to the give Site.
|
||||
@ -206,7 +205,7 @@ func RestoreSitePage(
|
||||
// Hydrate Page
|
||||
page, err := support.CreatePageFromBytes(byteArray)
|
||||
if err != nil {
|
||||
return dii, errors.Wrapf(err, "creating Page object %s", pageID)
|
||||
return dii, clues.Wrap(err, "creating Page object").WithClues(ctx)
|
||||
}
|
||||
|
||||
name, ok := ptr.ValOK(page.GetName())
|
||||
|
||||
@ -5,11 +5,11 @@ import (
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
discover "github.com/alcionai/corso/src/internal/connector/discovery/api"
|
||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
||||
|
||||
@ -5,13 +5,13 @@ import (
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
kioser "github.com/microsoft/kiota-serialization-json-go"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/sites"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
||||
|
||||
@ -4,9 +4,8 @@ import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/connector/discovery/api"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
||||
@ -40,7 +39,7 @@ func DataCollections(
|
||||
) ([]data.BackupCollection, map[string]map[string]struct{}, error) {
|
||||
b, err := selector.ToSharePointBackup()
|
||||
if err != nil {
|
||||
return nil, nil, errors.Wrap(err, "sharePointDataCollection: parsing selector")
|
||||
return nil, nil, clues.Wrap(err, "sharePointDataCollection: parsing selector")
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
@ -3,12 +3,12 @@ package sharepoint
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user