process/load-kp: add captureException

This commit is contained in:
vchikalkin 2023-07-11 22:36:34 +03:00
parent 0ea8c23c81
commit 7d3c27621e

View File

@ -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');