Skip to content

Commit

Permalink
Fix/sentry 2 (#393)
Browse files Browse the repository at this point in the history
* wip

* Ignore contract in format
  • Loading branch information
pavlovdog authored Jan 3, 2025
1 parent b286c27 commit 8c42caa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
3 changes: 2 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"pnpm-lock.yaml",
"src/lib",
".nyc_output",
"test/spec-tests"
"test/spec-tests",
"contracts"
]
},
"organizeImports": {
Expand Down
23 changes: 18 additions & 5 deletions src/cli/alto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
}
})
}

Expand Down

0 comments on commit 8c42caa

Please sign in to comment.