Fix T100757: error stating OpenEXR format is unknown format

Fix T100757 by reducing the log level to "info" when Blender writes output
to a file format the Worker cannot handle. Such cases are expected, and
now no longer result in an error message.
This commit is contained in:
Sybren A. Stüvel 2022-09-12 12:40:06 +02:00
parent 1ffd56939a
commit b3b46f89b2

View File

@ -5,6 +5,7 @@ package worker
import ( import (
"bytes" "bytes"
"context" "context"
"errors"
"image" "image"
"image/jpeg" "image/jpeg"
_ "image/png" _ "image/png"
@ -140,7 +141,15 @@ func loadAsJPEG(imagePath string) []byte {
// Try to decode the file as image. // Try to decode the file as image.
img, fileType, err := image.Decode(file) img, fileType, err := image.Decode(file)
if err != nil { switch {
case errors.Is(err, image.ErrFormat):
// Blender writing formats not supported by this Go code will happen, for
// example EXR files. This is fine, and shouldn't even trigger a warning.
logger.Info().Msg("output uploader: file a format I cannot decode, ignoring it")
return nil
case err != nil:
// Any other error than the above is more serious, though, because that
// could mean file corruption.
logger.Error().Err(err).Msg("output uploader: cannot decode image file") logger.Error().Err(err).Msg("output uploader: cannot decode image file")
return nil return nil
} }