Skip to content

Commit

Permalink
Improved error return
Browse files Browse the repository at this point in the history
  • Loading branch information
YamiOdymel committed Jul 5, 2023
1 parent c831570 commit a813034
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions image.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ffimage

import (
"bytes"
"errors"
"fmt"
"os"
Expand Down Expand Up @@ -244,9 +245,10 @@ func (i *Image) WriteImage(path string) error {
split1, split2.Filter("palettegen", ffmpeg.Args{})}, "paletteuse", ffmpeg.Args{})
}

err := input.Output(path, i.Output.Args...).OverWriteOutput().Silent(i.Silent).Run() // .ErrorToStdOut()
buf := bytes.NewBuffer(nil)
err := input.Output(path, i.Output.Args...).OverWriteOutput().Silent(i.Silent).WithErrorOutput(buf).Run()
if err != nil {
return err
return errors.New(buf.String())
}

if isSameInputOutput {
Expand Down

0 comments on commit a813034

Please sign in to comment.