From 9374890d795571ada3fee3060323db73f599cc8d Mon Sep 17 00:00:00 2001 From: Sergey Potekhin Date: Fri, 3 Jan 2025 23:15:51 +0400 Subject: [PATCH] wip --- src/cli/alto.ts | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/cli/alto.ts b/src/cli/alto.ts index ae06bd0e..b36509fa 100644 --- a/src/cli/alto.ts +++ b/src/cli/alto.ts @@ -14,6 +14,7 @@ import { serverOptions } from "./config" import { registerCommandToYargs } from "./util" +import { TimeoutError, HttpRequestError, InternalRpcError } from "viem" // Load environment variables from .env file if (process.env.DOTENV_CONFIG_PATH) { @@ -23,14 +24,26 @@ if (process.env.DOTENV_CONFIG_PATH) { } if (process.env.SENTRY_DSN) { + const SENTRY_IGNORE_ERRORS = [ + InternalRpcError, + HttpRequestError, + TimeoutError + ] + sentry.init({ dsn: process.env.SENTRY_DSN, environment: process.env.ENVIRONMENT, - ignoreErrors: [ - "RpcRequestError", - "ResourceNotFoundRpcError", - "HttpRequestError", - ] + beforeSend(event, hint) { + if ( + SENTRY_IGNORE_ERRORS.some( + (error) => hint.originalException instanceof error + ) + ) { + return null + } + + return event + } }) }