apps/web: add extra data for sentry
This commit is contained in:
parent
24987be78e
commit
8c69b3b9c4
@ -1,4 +1,4 @@
|
||||
import { link } from '@/config/apollo';
|
||||
import { link } from './link';
|
||||
import { ApolloClient, InMemoryCache } from '@apollo/client';
|
||||
import { isServer } from 'tools/common';
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import getUrls from './urls';
|
||||
import { ApolloLink, HttpLink } from '@apollo/client';
|
||||
import getUrls from '@/config/urls';
|
||||
import { ApolloLink, from, HttpLink } from '@apollo/client';
|
||||
import { onError } from '@apollo/client/link/error';
|
||||
import { getCurrentScope } from '@sentry/nextjs';
|
||||
|
||||
const { URL_CRM_GRAPHQL } = getUrls();
|
||||
|
||||
@ -42,4 +44,16 @@ const httpLink = new HttpLink({
|
||||
uri: URL_CRM_GRAPHQL,
|
||||
});
|
||||
|
||||
export const link = modifyDataLink.concat(httpLink);
|
||||
const errorLink = onError(({ graphQLErrors, networkError, operation, response }) => {
|
||||
const scope = getCurrentScope();
|
||||
scope.setTag('operationName', operation.operationName);
|
||||
|
||||
scope.setExtras({
|
||||
graphQLErrors,
|
||||
networkError,
|
||||
operation,
|
||||
response,
|
||||
});
|
||||
});
|
||||
|
||||
export const link = from([errorLink, modifyDataLink, httpLink]);
|
||||
Loading…
x
Reference in New Issue
Block a user