Skip to content

Commit

Permalink
return original cmd error message in the error string when we return …
Browse files Browse the repository at this point in the history
…the contents of our own stderr buffer
  • Loading branch information
SebastiaanKlippert committed Oct 26, 2023
1 parent c04f83e commit 40141b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wkhtmltopdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,11 @@ func (pdfg *PDFGenerator) run(ctx context.Context) error {
return ctxErr
}

// on an error, return the contents of Stderr if it was our own buffer
// on an error, return the error and the contents of Stderr if it was our own buffer
// if Stderr was set to a custom writer, just return err
if errBuf != nil {
if errStr := errBuf.String(); strings.TrimSpace(errStr) != "" {
return errors.New(errStr)
return fmt.Errorf("%s\n%s", errStr, err)
}
}
return err
Expand Down

0 comments on commit 40141b0

Please sign in to comment.