fix(logging): log level for graphql errors (#1530)

This commit is contained in:
Iain Sproat
2023-04-13 16:47:31 +01:00
committed by GitHub
parent 6f718d8d91
commit c6e36cdfce
+6 -1
View File
@@ -5,6 +5,7 @@ const { ApolloError } = require('apollo-server-express')
const prometheusClient = require('prom-client')
const { graphqlLogger } = require('@/logging/logging')
const { redactSensitiveVariables } = require('@/logging/loggingHelper')
const { GraphQLError } = require('graphql')
const metricCallCount = new prometheusClient.Counter({
name: 'speckle_server_apollo_calls',
@@ -73,7 +74,11 @@ module.exports = {
if (err.path) {
logger = logger.child({ 'query-path': err.path.join(' > ') })
}
logger.error(err, 'graphql error')
if (err instanceof GraphQLError && err.extensions?.code === 'FORBIDDEN') {
logger.info(err, 'graphql error')
} else {
logger.error(err, 'graphql error')
}
Sentry.withScope((scope) => {
scope.setTag('kind', kind)