mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Engine: clearer job error reporting
* Job.Error and Job.Errorf always print a newline. * Avoid redundant prefixing of error messages. Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
This commit is contained in:
parent
c63ce728cf
commit
8a1778301b
1 changed files with 5 additions and 2 deletions
|
@ -74,7 +74,7 @@ func (job *Job) Run() error {
|
|||
return err
|
||||
}
|
||||
if job.status != 0 {
|
||||
return fmt.Errorf("%s: %s", job.Name, errorMessage)
|
||||
return fmt.Errorf("%s", errorMessage)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -197,11 +197,14 @@ func (job *Job) Printf(format string, args ...interface{}) (n int, err error) {
|
|||
}
|
||||
|
||||
func (job *Job) Errorf(format string, args ...interface{}) Status {
|
||||
if format[len(format)-1] != '\n' {
|
||||
format = format + "\n"
|
||||
}
|
||||
fmt.Fprintf(job.Stderr, format, args...)
|
||||
return StatusErr
|
||||
}
|
||||
|
||||
func (job *Job) Error(err error) Status {
|
||||
fmt.Fprintf(job.Stderr, "%s", err)
|
||||
fmt.Fprintf(job.Stderr, "%s\n", err)
|
||||
return StatusErr
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue