Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: try and catch around sending notification

Marc Seitz2e4794464420
diff --git a/lib/emails/process-dataroom-digest.ts b/lib/emails/process-dataroom-digest.ts
index e430fb8a..14ee9b65 100644
--- a/lib/emails/process-dataroom-digest.ts
+++ b/lib/emails/process-dataroom-digest.ts
@@ -110,13 +110,21 @@ async function processBatch(batch: DigestBatch, frequency: "daily" | "weekly") {
teamId: batch.teamId,
});
- await sendDataroomDigestNotification({
- dataroomName: dataroom?.name ?? "Unknown Dataroom",
- documents,
- senderEmail: senderUser?.email ?? "[email protected]",
- to: viewer.email,
- url: linkUrl,
- preferencesUrl,
- frequency,
- });
+ try {
+ await sendDataroomDigestNotification({
+ dataroomName: dataroom?.name ?? "Unknown Dataroom",
+ documents,
+ senderEmail: senderUser?.email ?? "[email protected]",
+ to: viewer.email,
+ url: linkUrl,
+ preferencesUrl,
+ frequency,
+ });
+ } catch (error) {
+ throw new Error(
+ `Failed to send ${frequency} digest for dataroom "${dataroom?.name}" ` +
+ `from ${senderUser?.email ?? "unknown sender"} to ${viewer.email}: ` +
+ `${(error as Error).message}`,
+ );
+ }
}
diff --git a/lib/emails/send-dataroom-digest-notification.ts b/lib/emails/send-dataroom-digest-notification.ts
index 8fd3347b..05d52c59 100644
--- a/lib/emails/send-dataroom-digest-notification.ts
+++ b/lib/emails/send-dataroom-digest-notification.ts
@@ -40,5 +40,6 @@ export const sendDataroomDigestNotification = async ({
});
} catch (e) {
console.error(e);
+ throw e;
}
};