diff options
author | Josh Bialkowski <josh.bialkowski@gmail.com> | 2019-12-16 09:09:42 -0800 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-01-04 13:04:21 +0100 |
commit | a785bcdad6296b3babeb62ef3e91d66450730244 (patch) | |
tree | 635270c06b8fcba9780f0399dfbd6daa7a9f7c13 /bridge/core/import.go | |
parent | f15206e7b1d60239f4e42c618297554bda524b5e (diff) | |
download | git-bug-a785bcdad6296b3babeb62ef3e91d66450730244.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.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/bridge/core/import.go b/bridge/core/import.go index 5f138da7..f0a6f0c8 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" ) @@ -74,10 +75,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") |