Skip to content

Commit

Permalink
feat(sentry): Drop redis connection error event and UNKNOWN_INTERACTION
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiyan114 committed Jul 31, 2023
1 parent 5487ff1 commit b6dac0d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Components
import { Client, GatewayIntentBits as Intents, Partials, ActivityType } from "discord.js";
import { Client, GatewayIntentBits as Intents, Partials, ActivityType, DiscordAPIError } from "discord.js";
import { init as sentryInit } from "@sentry/node";
import { ExtraErrorData, RewriteFrames } from "@sentry/integrations";
import {botToken, guildID, twitch} from "./config";
Expand Down Expand Up @@ -31,6 +31,7 @@ if(process.env["SENTRY_DSN"]) {
}
})
],

beforeBreadcrumb: (breadcrumb) => {
// List of urls to ignore
const ignoreUrl = [
Expand All @@ -45,12 +46,18 @@ if(process.env["SENTRY_DSN"]) {

return breadcrumb;
},

ignoreErrors: [
"ETIMEDOUT",
"EADDRINUSE"
"EADDRINUSE",
"ENOTFOUND"
],
beforeSend : (evnt) => {
beforeSend : (evnt, hint) => {
if(evnt.tags && evnt.tags["isEval"]) return null;

const ex = hint.originalException;
if(ex instanceof DiscordAPIError && ex.code === APIErrors.UNKNOWN_INTERACTION) return null;

return evnt;
},
release: execSync(`git -C ${__dirname} rev-parse HEAD`).toString().trim() // Pull Release Data
Expand All @@ -76,6 +83,7 @@ export const client = new Client({
export const streamCli = new tStreamClient(twitch.channel);
/* Internal Services */
import { loadClientModule } from "./services";
import { APIErrors } from "./utils/discordErrorCode";


client.on("ready", async () => {
Expand Down

0 comments on commit b6dac0d

Please sign in to comment.