MCPcopy Index your code
hub / github.com/git-bug/git-bug / String

Method String

bridge/core/import.go:56–101  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54}
55
56func (er ImportResult) String() string {
57 switch er.Event {
58 case ImportEventBug:
59 return fmt.Sprintf("[%s] new issue: %s", er.EntityId.Human(), er.EntityId)
60 case ImportEventComment:
61 return fmt.Sprintf("[%s] new comment: %s", er.EntityId.Human(), er.ComponentId)
62 case ImportEventCommentEdition:
63 return fmt.Sprintf("[%s] updated comment: %s", er.EntityId.Human(), er.ComponentId)
64 case ImportEventStatusChange:
65 return fmt.Sprintf("[%s] changed status with op: %s", er.EntityId.Human(), er.OperationId)
66 case ImportEventTitleEdition:
67 return fmt.Sprintf("[%s] changed title with op: %s", er.EntityId.Human(), er.OperationId)
68 case ImportEventLabelChange:
69 return fmt.Sprintf("[%s] changed label with op: %s", er.EntityId.Human(), er.OperationId)
70 case ImportEventIdentity:
71 return fmt.Sprintf("[%s] new identity: %s", er.EntityId.Human(), er.EntityId)
72 case ImportEventNothing:
73 if er.EntityId != "" {
74 return fmt.Sprintf("no action taken on entity %s: %s", er.EntityId, er.Reason)
75 }
76 return fmt.Sprintf("no action taken: %s", er.Reason)
77 case ImportEventError:
78 if er.EntityId != "" {
79 return fmt.Sprintf("import error on entity %s: %s", er.EntityId, er.Err.Error())
80 }
81 return fmt.Sprintf("import error: %s", er.Err.Error())
82 case ImportEventWarning:
83 parts := make([]string, 0, 4)
84 parts = append(parts, "warning:")
85 if er.EntityId != "" {
86 parts = append(parts, fmt.Sprintf("on entity %s", er.EntityId))
87 }
88 if er.Reason != "" {
89 parts = append(parts, fmt.Sprintf("reason: %s", er.Reason))
90 }
91 if er.Err != nil {
92 parts = append(parts, fmt.Sprintf("err: %s", er.Err))
93 }
94 return strings.Join(parts, " ")
95 case ImportEventRateLimiting:
96 return fmt.Sprintf("rate limiting: %s", er.Reason)
97
98 default:
99 panic("unknown import result")
100 }
101}
102
103func NewImportError(err error, entityId entity.Id) ImportResult {
104 return ImportResult{

Callers

nothing calls this directly

Calls 2

HumanMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected