Skip to content

Commit

Permalink
Change SetExitMessage from taking a string to an error
Browse files Browse the repository at this point in the history
  • Loading branch information
dadgar committed Nov 16, 2015
1 parent 9aa9a22 commit 95222f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 4 additions & 5 deletions client/task_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions nomad/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 95222f6

Please sign in to comment.