SUPPORT-8725: refactor trowing raw exception

This commit is contained in:
adel.kalimullin 2024-12-11 13:45:59 +03:00
parent 7163c1ae5a
commit 0744ca6331

View file

@ -83,7 +83,7 @@ public class FileUploadService {
Files.createDirectories(Paths.get(fileSavingPath)); Files.createDirectories(Paths.get(fileSavingPath));
} }
catch (IOException e) { catch (IOException e) {
throw new RuntimeException("Failed to create directory " + fileSavingPath, e); throw new FileUploadException("Failed to create directory " + fileSavingPath, e);
} }
LOGGER.info("working in {}", System.getProperty("user.home")); LOGGER.info("working in {}", System.getProperty("user.home"));
Path filePath = Paths.get(fileSavingPath, fileUrl.fileName()); Path filePath = Paths.get(fileSavingPath, fileUrl.fileName());
@ -131,7 +131,7 @@ public class FileUploadService {
Files.delete(filePath); Files.delete(filePath);
} }
catch (IOException e) { catch (IOException e) {
throw new RuntimeException("Failed to delete file " + filePath.getFileName()); throw new FileUploadException("Failed to delete file " + filePath.getFileName());
} }
finally { finally {
acknowledgment.acknowledge(); acknowledgment.acknowledge();