Skip to content

Commit 515d2ec

Browse files
committed
Improve failure logs
1 parent 61ccd95 commit 515d2ec

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/java/com/github/stickerifier/stickerify/bot/Stickerify.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public int process(List<Update> updates) {
8686

8787
@Override
8888
public void onException(TelegramException e) {
89-
LOGGER.at(Level.ERROR).addKeyValue("exception_message", e.getMessage()).log("There was an unexpected failure");
89+
LOGGER.at(Level.ERROR).setCause(e).addKeyValue("exception_message", e.getMessage()).log("An unexpected failure occurred");
9090
}
9191

9292
@Override

src/main/java/com/github/stickerifier/stickerify/media/MediaHelper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private static String detectMimeType(File file) throws MediaException {
8181
try {
8282
return TIKA.detect(file);
8383
} catch (IOException e) {
84-
LOGGER.at(Level.ERROR).addKeyValue("file_name", file.getName()).log("Unable to retrieve MIME type");
84+
LOGGER.at(Level.ERROR).setCause(e).addKeyValue("file_name", file.getName()).log("Unable to retrieve MIME type");
8585
throw new MediaException(e);
8686
}
8787
}
@@ -252,8 +252,8 @@ private static boolean isAnimatedStickerCompliant(File file, String mimeType) th
252252

253253
try (var gzipInputStream = new GZIPInputStream(new FileInputStream(file))) {
254254
uncompressedContent = new String(gzipInputStream.readAllBytes(), UTF_8);
255-
} catch (IOException _) {
256-
LOGGER.at(Level.ERROR).addKeyValue("file_name", file.getName()).log("Unable to retrieve gzip content");
255+
} catch (IOException e) {
256+
LOGGER.at(Level.ERROR).setCause(e).addKeyValue("file_name", file.getName()).log("Unable to retrieve gzip content");
257257
}
258258

259259
try {

0 commit comments

Comments
 (0)