Lint project

This commit is contained in:
Kurt Hutten
2021-06-24 20:36:56 +10:00
parent df5fc0a100
commit 52bf8922c4
4 changed files with 20 additions and 22 deletions

View File

@@ -62,45 +62,44 @@ export const createSentryApolloPlugin: Config['plugins'][number] = () => ({
// If we couldn't parse the operation, don't
// do anything here
if (!ctx.operation) {
return;
return
}
for (const err of ctx.errors) {
// Only report internal server errors,
// all errors extending ApolloError should be user-facing
if (err instanceof ApolloError) {
continue;
continue
}
// Add scoped report details and send to Sentry
Sentry.withScope(scope => {
Sentry.withScope((scope) => {
// Annotate whether failing operation was query/mutation/subscription
scope.setTag("kind", ctx.operation.operation);
scope.setTag('kind', ctx.operation.operation)
// Log query and variables as extras (make sure to strip out sensitive data!)
scope.setExtra("query", ctx.request.query);
scope.setExtra("variables", ctx.request.variables);
scope.setExtra('query', ctx.request.query)
scope.setExtra('variables', ctx.request.variables)
if (err.path) {
// We can also add the path as breadcrumb
scope.addBreadcrumb({
category: "query-path",
message: err.path.join(" > "),
level: Sentry.Severity.Debug
});
category: 'query-path',
message: err.path.join(' > '),
level: Sentry.Severity.Debug,
})
}
const transactionId = ctx.request.http.headers.get(
"x-transaction-id"
);
const transactionId =
ctx.request.http.headers.get('x-transaction-id')
if (transactionId) {
scope.setTransaction(transactionId);
scope.setTransaction(transactionId)
}
Sentry.captureException(err);
});
Sentry.captureException(err)
})
}
}
},
}
}
},
})