Skip to content

Commit 482b9c9

Browse files
[FIX][SDK-98] Crash creating folder (#318)
* fix: log the error instead of throwing an exception * docs: add comment
1 parent a772ee2 commit 482b9c9

File tree

1 file changed

+6
-2
lines changed
  • rollbar-java/src/main/java/com/rollbar/notifier/sender/queue

1 file changed

+6
-2
lines changed

rollbar-java/src/main/java/com/rollbar/notifier/sender/queue/DiskQueue.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,18 @@ private DiskQueue(Builder builder) {
4141
this.maxSize = builder.maxSize;
4242
this.queueFolder = builder.queueFolder;
4343

44+
/*
45+
A RuntimeException can cause a silent crash, since the error would not be saved and in the next
46+
session there would be no payload to send. So we just log the error.
47+
*/
4448
if (!this.queueFolder.exists()) {
4549
if (!this.queueFolder.mkdirs()) {
46-
throw new RuntimeException("Could not create folder: " + queueFolder);
50+
LOGGER.error("Could not create folder: {}", queueFolder);
4751
}
4852
}
4953

5054
if (!this.queueFolder.canRead() || !this.queueFolder.canWrite()) {
51-
throw new RuntimeException("Not enough permissions folder: " + queueFolder);
55+
LOGGER.error("Not enough permissions folder: {}", queueFolder);
5256
}
5357
}
5458

0 commit comments

Comments
 (0)