Skip to content

Commit 2c52a00

Browse files
committed
Log when a file could not be deleted
1 parent 24e414e commit 2c52a00

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
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
@@ -221,7 +221,7 @@ private static void deleteTempFiles(Set<Path> pathsToDelete) {
221221
for (var path : pathsToDelete) {
222222
try {
223223
if (!Files.deleteIfExists(path)) {
224-
LOGGER.atWarn().log("Unable to delete temp file {}", path);
224+
LOGGER.atInfo().log("Unable to delete temp file {}", path);
225225
}
226226
} catch (IOException e) {
227227
LOGGER.atError().setCause(e).log("An error occurred trying to delete temp file {}", path);

src/main/java/com/github/stickerifier/stickerify/exception/FileOperationException.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,4 @@ public FileOperationException(Throwable cause) {
88
public FileOperationException(String message, Throwable cause) {
99
super(message, cause);
1010
}
11-
12-
public FileOperationException(String message) {
13-
super(message);
14-
}
1511
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ private static File createTempFile(String fileExtension) throws FileOperationExc
320320
private static void deleteFile(File file) throws FileOperationException {
321321
try {
322322
if (!Files.deleteIfExists(file.toPath())) {
323-
throw new FileOperationException("An error occurred deleting the file");
323+
LOGGER.atInfo().log("Unable to delete file {}", file.toPath());
324324
}
325325
} catch (IOException e) {
326326
throw new FileOperationException("An error occurred deleting the file", e);

0 commit comments

Comments
 (0)