set image type on error

This commit is contained in:
Timo 2021-04-18 11:31:33 +03:00
parent a34d2fb675
commit 42fcea85d3

View File

@ -12,7 +12,6 @@ import org.springframework.stereotype.Service;
import javax.imageio.ImageIO;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@Slf4j
@Service
@ -37,6 +36,7 @@ public class ImageClassificationService {
image.setImageType(ImageType.valueOf(response.getCategory()));
} catch (Exception e) {
log.error("Could not classify image", e);
image.setImageType(ImageType.OTHER);
}
log.info("Image classification took: " + (System.currentTimeMillis() - start));