aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/core/import.go
diff options
context:
space:
mode:
authorJosh Bialkowski <josh.bialkowski@gmail.com>2019-12-16 09:09:42 -0800
committerJosh Bialkowski <josh.bialkowski@gmail.com>2019-12-18 07:42:16 -0800
commit3384d1b26bea41224c260b1912c51e0564571422 (patch)
treeed4fa71cf94fbd112556b43cff0818ae3057415b /bridge/core/import.go
parent4e64c834e2cd672f3daff59fe8117873688dfebc (diff)
downloadgit-bug-3384d1b26bea41224c260b1912c51e0564571422.tar.gz
codereview #6: don't fail one warning
* presence of an error in the import event doesn't indicate failure
Diffstat (limited to 'bridge/core/import.go')
-rw-r--r--bridge/core/import.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/bridge/core/import.go b/bridge/core/import.go
index 109fae85..3b1f3ac3 100644
--- a/bridge/core/import.go
+++ b/bridge/core/import.go
@@ -2,6 +2,7 @@ package core
import (
"fmt"
+ "strings"
"github.com/MichaelMure/git-bug/entity"
)
@@ -71,10 +72,18 @@ func (er ImportResult) String() string {
}
return fmt.Sprintf("import error: %s", er.Err.Error())
case ImportEventWarning:
+ parts := make([]string, 0, 4)
+ parts = append(parts, "warning:")
if er.ID != "" {
- return fmt.Sprintf("warning at id %s: %s", er.ID, er.Err.Error())
+ parts = append(parts, fmt.Sprintf("at id %s", er.ID))
}
- return fmt.Sprintf("warning: %s", er.Err.Error())
+ if er.Reason != "" {
+ parts = append(parts, fmt.Sprintf("reason: %s", er.Reason))
+ }
+ if er.Err != nil {
+ parts = append(parts, fmt.Sprintf("err: %s", er.Err))
+ }
+ return strings.Join(parts, " ")
default:
panic("unknown import result")