Skip to content

Commit

Permalink
add sentry monitoring for hocuspocus server
Browse files Browse the repository at this point in the history
  • Loading branch information
robguthrie committed Jul 26, 2024
1 parent fa9decc commit a468f48
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion hocuspocus.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
"use strict";
import * as Sentry from "@sentry/node";
const dsn = process.env.SENTRY_PUBLIC_DSN || process.env.SENTRY_DSN

if (dsn) {
console.log("sentry dsn: ", dsn);
Sentry.init({dsn});
}

import { Server } from "@hocuspocus/server";
import { SQLite } from "@hocuspocus/extension-sqlite";
import { Logger } from "@hocuspocus/extension-logger";
Expand Down Expand Up @@ -35,4 +43,12 @@ const server = Server.configure({
},
});

server.listen();
if (dsn) {
try {
server.listen();
} catch (e) {
Sentry.captureException(e);
}
} else {
server.listen();
}

0 comments on commit a468f48

Please sign in to comment.