Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/ws-worker/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ const DEFAULT_PORT = 2222;
const MIN_BACKOFF = 1000;
const MAX_BACKOFF = 1000 * 30;

const IGNORED_ERROR_PATTERNS: RegExp[] = [/OAuth token has expired/i];

// TODO move out into another file, make testable, test in isolation
function connect(app: ServerApp, logger: Logger, options: ServerOptions = {}) {
logger.debug('Connecting to Lightning at', options.lightning);
Expand Down Expand Up @@ -247,6 +249,16 @@ function createServer(engine: RuntimeEngine, options: ServerOptions = {}) {
Sentry.init({
environment: options.sentryEnv,
dsn: options.sentryDsn,
beforeSend(event, hint) {
const error = hint.originalException as Error | undefined;
const message = error?.message ?? event.message ?? '';

if (IGNORED_ERROR_PATTERNS.some((pattern) => pattern.test(message))) {
return null;
}

return event;
},
});
Sentry.setupKoaErrorHandler(app);
}
Expand Down