Skip to content

Commit

Permalink
fix(caicloud#330): fix panic error when abort pipeline which has no log
Browse files Browse the repository at this point in the history
  • Loading branch information
supereagle committed Mar 4, 2018
1 parent 49f73b9 commit b44775b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,15 @@ func postHookEvent(event *api.Event) {

// generateAbortedStateLog generates aborted state log for last stage to illustrate that the record is aborted.
func generateAbortedStateLog(log string) string {
subLogs := log[strings.LastIndex(log, "\nstep: "):]
i := strings.Index(subLogs, " state: ")
additionalLog := subLogs[1:i+8] + "aborted\n"
if strings.Contains(log, "\nstep: ") && strings.Contains(log, " state: ") {
subLogs := log[strings.LastIndex(log, "\nstep: "):]
i := strings.Index(subLogs, " state: ")
additionalLog := subLogs[1:i+8] + "aborted\n"

return additionalLog
return additionalLog
}

return ""
}

// createServiceHander is the create service handler.
Expand Down

0 comments on commit b44775b

Please sign in to comment.