Skip to content

Commit 85e3425

Browse files
committed
[NAE-2405] QRService dependency rework
- Add error logging for file write failures in `QrService`. - Enhance exception handling with detailed log context.
1 parent 6b0a5dd commit 85e3425

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • application-engine/src/main/java/com/netgrif/application/engine/business/qr

application-engine/src/main/java/com/netgrif/application/engine/business/qr/QrService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ private File generateFile(QrCode code) throws WriterException, IOException {
9898

9999
try (OutputStream outputStream = Files.newOutputStream(outputPath)) {
100100
MatrixToImageWriter.writeToStream(bitMatrix, resolveImageFormat(code), outputStream, config);
101+
} catch (IOException e) {
102+
log.error("Failed to write QR code to file [file={}, path={}]", code.getFileName(), outputPath.toAbsolutePath(), e);
103+
throw e;
101104
}
102105

103106
return outputPath.toFile();
@@ -216,6 +219,7 @@ private void writeImageToFile(BufferedImage image, QrCode code) throws IOExcepti
216219
try (OutputStream outputStream = Files.newOutputStream(outputPath)) {
217220
boolean written = ImageIO.write(image, format, outputStream);
218221
if (!written) {
222+
log.error("Failed to write image to disk [file={}, format={}, path={}]", code.getFileName(), format, outputPath.toAbsolutePath());
219223
throw new IOException("No ImageIO writer found for format: " + format);
220224
}
221225
}

0 commit comments

Comments
 (0)