filter: basic: add error checking for close()

This commit is contained in:
Ella Pietraroia 2020-02-03 10:55:12 +10:30
parent d4c60358a9
commit 17e1eb0436
1 changed files with 4 additions and 1 deletions

View File

@ -80,7 +80,10 @@ func NewBasic(dst io.WriteCloser, debug bool, t, p int) *Basic {
// Implements io.Closer.
func (bf *Basic) Close() error {
if bf.debug {
bf.file.Close()
err := bf.file.Close()
if err != nil {
return fmt.Errorf("file cannot be closed: %w", err)
}
}
return nil
}