Change SetExitMessage from taking a string to an error
This commit is contained in:
parent
e76a613974
commit
ea0edd8c2f
|
@ -303,11 +303,10 @@ func (r *TaskRunner) run() {
|
|||
|
||||
// Helper function for converting a WaitResult into a TaskTerminated event.
|
||||
func (r *TaskRunner) waitErrorToEvent(res *cstructs.WaitResult) *structs.TaskEvent {
|
||||
e := structs.NewTaskEvent(structs.TaskTerminated).SetExitCode(res.ExitCode).SetSignal(res.Signal)
|
||||
if res.Err != nil {
|
||||
e.SetExitMessage(res.Err.Error())
|
||||
}
|
||||
return e
|
||||
return structs.NewTaskEvent(structs.TaskTerminated).
|
||||
SetExitCode(res.ExitCode).
|
||||
SetSignal(res.Signal).
|
||||
SetExitMessage(res.Err)
|
||||
}
|
||||
|
||||
// Update is used to update the task of the context
|
||||
|
|
|
@ -1128,8 +1128,10 @@ func (e *TaskEvent) SetSignal(s int) *TaskEvent {
|
|||
return e
|
||||
}
|
||||
|
||||
func (e *TaskEvent) SetExitMessage(m string) *TaskEvent {
|
||||
e.Message = m
|
||||
func (e *TaskEvent) SetExitMessage(err error) *TaskEvent {
|
||||
if err != nil {
|
||||
e.Message = err.Error()
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue