From a47e08a286ef714bac79ba1b4f5b113198c9a1d5 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Tue, 11 Jul 2023 19:46:47 +0300 Subject: [PATCH] utils/axios: fix exception message --- apps/web/utils/axios.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/web/utils/axios.ts b/apps/web/utils/axios.ts index d9b56bf..2e50bef 100644 --- a/apps/web/utils/axios.ts +++ b/apps/web/utils/axios.ts @@ -1,4 +1,4 @@ -import { captureException, withScope } from '@sentry/nextjs'; +import { captureException, captureMessage, withScope } from '@sentry/nextjs'; import type { AxiosError } from 'axios'; import { isAxiosError } from 'axios'; import { pick } from 'radash'; @@ -21,13 +21,14 @@ export async function withHandleError(fn: Promise) { const data = error_.config?.data; const params = error_.config?.params; - const opts = { ...err, data, params }; const message = getErrorMessage(error_); + const opts = { ...err, data, message, params }; withScope((scope) => { (Object.keys(opts) as Array).forEach((key) => { scope.setExtra(key, JSON.stringify(opts[key])); }); + captureMessage(message); captureException(error_); });