From df412430ab35106df57bc32d6dd01bd088bf4735 Mon Sep 17 00:00:00 2001 From: Amine Hilaly Date: Sat, 17 Aug 2019 23:46:10 +0200 Subject: bridge/github: improve error handling and Nothing events vendor: add package golang.org/x/sync/errgroup --- bridge/core/export.go | 4 ++-- bridge/core/import.go | 4 ++-- bridge/github/import.go | 3 +-- bridge/gitlab/import.go | 3 +-- 4 files changed, 6 insertions(+), 8 deletions(-) (limited to 'bridge') diff --git a/bridge/core/export.go b/bridge/core/export.go index 55cf5a60..ceae1401 100644 --- a/bridge/core/export.go +++ b/bridge/core/export.go @@ -46,9 +46,9 @@ func (er ExportResult) String() string { return fmt.Sprintf("changed label: %s", er.ID) case ExportEventNothing: if er.ID != "" { - return fmt.Sprintf("ignoring export event %s: %s", er.ID, er.Reason) + return fmt.Sprintf("no actions taken for event %s: %s", er.ID, er.Reason) } - return fmt.Sprintf("ignoring export event: %s", er.Reason) + return fmt.Sprintf("no actions taken: %s", er.Reason) case ExportEventError: if er.ID != "" { return fmt.Sprintf("export error at %s: %s", er.ID, er.Err.Error()) diff --git a/bridge/core/import.go b/bridge/core/import.go index 0961e00b..cff30f61 100644 --- a/bridge/core/import.go +++ b/bridge/core/import.go @@ -49,9 +49,9 @@ func (er ImportResult) String() string { return fmt.Sprintf("new identity: %s", er.ID) case ImportEventNothing: if er.ID != "" { - return fmt.Sprintf("ignoring import event %s: %s", er.ID, er.Reason) + return fmt.Sprintf("no action taken for event %s: %s", er.ID, er.Reason) } - return fmt.Sprintf("ignoring event: %s", er.Reason) + return fmt.Sprintf("no action taken: %s", er.Reason) case ImportEventError: if er.ID != "" { return fmt.Sprintf("import error at id %s: %s", er.ID, er.Err.Error()) diff --git a/bridge/github/import.go b/bridge/github/import.go index 9fef9cb5..7c4deb50 100644 --- a/bridge/github/import.go +++ b/bridge/github/import.go @@ -369,8 +369,7 @@ func (gi *githubImporter) ensureTimelineComment(repo *cache.RepoCache, b *cache. targetOpID, err := b.ResolveOperationWithMetadata(keyGithubId, parseId(item.Id)) if err == nil { - reason := fmt.Sprintf("comment already imported") - gi.out <- core.NewImportNothing("", reason) + gi.out <- core.NewImportNothing("", "comment already imported") } else if err != cache.ErrNoMatchingOp { // real error return err diff --git a/bridge/gitlab/import.go b/bridge/gitlab/import.go index 40ac06d3..1391bf88 100644 --- a/bridge/gitlab/import.go +++ b/bridge/gitlab/import.go @@ -99,8 +99,7 @@ func (gi *gitlabImporter) ensureIssue(repo *cache.RepoCache, issue *gitlab.Issue // resolve bug b, err := repo.ResolveBugCreateMetadata(keyGitlabUrl, issue.WebURL) if err == nil { - reason := fmt.Sprintf("bug already imported") - gi.out <- core.NewImportNothing("", reason) + gi.out <- core.NewImportNothing("", "bug already imported") return b, nil } if err != bug.ErrBugNotExist { -- cgit