From 63c0fbf62c5f7c9ffba4c366da60b71f047917b0 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Tue, 4 Oct 2022 15:43:01 +1100 Subject: capture exception in sentry for embed processing --- src/api/util/handlers/Message.ts | 6 ++++++ src/gateway/events/Message.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts index e4b74f48..68fd37de 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts @@ -27,6 +27,7 @@ import { import { HTTPError } from "lambert-server"; import { In } from "typeorm"; import { EmbedHandlers } from "@fosscord/api"; +import * as Sentry from "@sentry/node"; const allow_empty = false; // TODO: check webhook, application, system author, stickers // TODO: embed gifs/videos/images @@ -219,6 +220,11 @@ export async function postHandleMessage(message: Message) { } } catch (e) { + Sentry.captureException(e, scope => { + scope.clear(); + scope.setContext("request", { url }) + return scope; + }); continue; } } diff --git a/src/gateway/events/Message.ts b/src/gateway/events/Message.ts index 07a4e2a9..9fafae1e 100644 --- a/src/gateway/events/Message.ts +++ b/src/gateway/events/Message.ts @@ -53,7 +53,7 @@ export async function Message(this: WebSocket, buffer: WS.Data) { try { var ret = await OPCodeHandler.call(this, data); - // transaction.finish(); + transaction.finish(); return ret; } catch (error) { Sentry.captureException(error); -- cgit 1.4.1