From 7d3c27621e71477d61985316742180c24dd09eb6 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Tue, 11 Jul 2023 22:36:34 +0300 Subject: [PATCH] process/load-kp: add captureException --- apps/web/process/load-kp/reactions.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/web/process/load-kp/reactions.ts b/apps/web/process/load-kp/reactions.ts index 2c91686..dbec1eb 100644 --- a/apps/web/process/load-kp/reactions.ts +++ b/apps/web/process/load-kp/reactions.ts @@ -2,12 +2,13 @@ import eltHelper from '../elt/lib/helper'; import { message } from '@/Components/Common/Notification'; import type { ProcessContext } from '@/process/types'; +import { captureException, withScope } from '@sentry/nextjs'; import { reaction } from 'mobx'; import { omit } from 'radash'; const key = 'KP_LOADING_INFO'; -export function common({ store, trpcClient, apolloClient }: ProcessContext) { +export function common({ store, trpcClient, apolloClient, user }: ProcessContext) { const { $calculation, $process, $tables } = store; const { init: initElt } = eltHelper({ apolloClient, store }); @@ -85,12 +86,18 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) { key, }); }) - .catch(() => { + .catch((error_) => { message.error({ content: `Ошибка во время загрузки КП ${quote.label}`, key, }); $calculation.element('selectQuote').resetValue(); + + withScope((scope) => { + scope.setExtra('quote', quote); + scope.setExtra('user', user); + captureException(error_); + }); }) .finally(() => { $process.delete('LoadKP');