diff options
Diffstat (limited to 'gateway/src/events/Message.ts')
-rw-r--r-- | gateway/src/events/Message.ts | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gateway/src/events/Message.ts b/gateway/src/events/Message.ts index 1a177e0c..0b1a8b2c 100644 --- a/gateway/src/events/Message.ts +++ b/gateway/src/events/Message.ts @@ -9,6 +9,7 @@ import { Tuple } from "lambert-server"; import { check } from "../opcodes/instanceOf"; import WS from "ws"; import BigIntJson from "json-bigint"; +import Sentry from "@Sentry/node"; const bigIntJson = BigIntJson({ storeAsString: true }); const PayloadSchema = { @@ -50,9 +51,22 @@ export async function Message(this: WebSocket, buffer: WS.Data) { return; } + const transaction = Sentry.startTransaction({ + op: OPCODES[data.op], + name: `GATEWAY ${OPCODES[data.op]}`, + data: { + ...data.d, + token: data.d.token ? "[Redacted]" : undefined, + }, + }); + try { - return await OPCodeHandler.call(this, data); + var ret = await OPCodeHandler.call(this, data); + transaction.finish(); + return ret; } catch (error) { + Sentry.captureException(error); + transaction.finish(); console.error(`Error: Op ${data.op}`, error); // if (!this.CLOSED && this.CLOSING) return this.close(CLOSECODES.Unknown_error); |