mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-14 08:45:30 +03:00
codereview #6: don't fail one warning
* presence of an error in the import event doesn't indicate failure
This commit is contained in:
parent
f15206e7b1
commit
a785bcdad6
@ -347,7 +347,7 @@ func (b *Bridge) ImportAllSince(ctx context.Context, since time.Time) (<-chan Im
|
||||
|
||||
// relay all events while checking that everything went well
|
||||
for event := range events {
|
||||
if event.Err != nil {
|
||||
if event.Event == ImportEventError {
|
||||
noError = false
|
||||
}
|
||||
out <- event
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user