Skip to content

Commit acdfd7e

Browse files
fix: log all unexpected errors to sentry
1 parent c994911 commit acdfd7e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/interactions/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Sentry from "@sentry/node";
12
import {
23
APIApplicationCommandAutocompleteGuildInteraction,
34
APIApplicationCommandAutocompleteInteraction,
@@ -657,12 +658,16 @@ const interactionsPlugin = async (instance: FastifyInstance) => {
657658
`\nError code: \`${error.status}\`` +
658659
"\n*PS: This shouldn't happen*";
659660
components = error.components;
661+
Sentry.captureException(error);
662+
instance.log.error(error);
660663
} else if (error instanceof Outage) {
661664
errorMessage =
662665
`:exclamation: There is currently an outage! Please check https://status--message.anothercat.me for updates - or join the support server` +
663666
`\nOutage error: ${error.message}` +
664667
`\nOutage error code: \`${error.status}\``;
665668
components = error.components;
669+
Sentry.captureException(error);
670+
instance.log.error(error);
666671
} else {
667672
// Expected errors
668673
errorMessage = `:exclamation: ${error.message}`;
@@ -679,6 +684,8 @@ const interactionsPlugin = async (instance: FastifyInstance) => {
679684
status: InteractionOrRequestFinalStatus.GATEWAY_CACHE_SHARD_OUTAGE,
680685
deferred: internalInteraction.deferred.toString(),
681686
});
687+
Sentry.captureException(error);
688+
instance.log.error(error);
682689
} else {
683690
const message =
684691
(error as Error | undefined) !== undefined &&
@@ -690,6 +697,7 @@ const interactionsPlugin = async (instance: FastifyInstance) => {
690697
type: internalInteraction.interaction.type,
691698
status: InteractionOrRequestFinalStatus.GENERIC_UNEXPECTED_FAILURE,
692699
});
700+
Sentry.captureException(error);
693701
instance.log.error(error);
694702
errorMessage =
695703
":exclamation: Something went wrong! Please try again." +

0 commit comments

Comments
 (0)