From ba89e8ba0b94388de511697300469ff18651daef Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Wed, 25 Oct 2023 18:15:02 +0700 Subject: [PATCH] fix: skip logging graphQl Errors --- src/helpers/metrics.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/helpers/metrics.ts b/src/helpers/metrics.ts index 500a62d9..6d289296 100644 --- a/src/helpers/metrics.ts +++ b/src/helpers/metrics.ts @@ -1,7 +1,7 @@ import init, { client } from '@snapshot-labs/snapshot-metrics'; import { capture } from '@snapshot-labs/snapshot-sentry'; import { Express, type Request, type Response } from 'express'; -import { parse } from 'graphql'; +import { GraphQLError, parse } from 'graphql'; import { spacesMetadata } from './spaces'; import { strategies } from './strategies'; import db from './mysql'; @@ -71,7 +71,9 @@ export default function initMetrics(app: Express) { } } } catch (e: any) { - capture(e); + if (!(e instanceof GraphQLError)) { + capture(e); + } } }); }