apps/web: show apollo error for user

This commit is contained in:
vchikalkin 2024-03-01 11:28:36 +03:00
parent c9326697f6
commit f7110497d3

View File

@ -1,8 +1,10 @@
/* eslint-disable sonarjs/cognitive-complexity */
import { message } from '@/Components/Common/Notification';
import getUrls from '@/config/urls';
import { ApolloLink, from, HttpLink } from '@apollo/client';
import { onError } from '@apollo/client/link/error';
import { getCurrentScope } from '@sentry/nextjs';
import { isServer } from 'tools';
const { URL_CRM_GRAPHQL } = getUrls();
@ -63,6 +65,13 @@ const errorLink = onError(({ graphQLErrors, networkError, operation, response })
const scope = getCurrentScope();
scope.setTag('operationName', operation.operationName);
if (!isServer()) {
message.error({
content: `Ошибка во время загрузки данных из CRM`,
key: 'APOLLO_GRAPHQL',
});
}
scope.setExtras({
graphQLErrors,
networkError,