utils/axios: use captureMessage

This commit is contained in:
vchikalkin 2023-07-11 20:57:15 +03:00
parent a47e08a286
commit 0109061a84

View File

@ -1,4 +1,4 @@
import { captureException, captureMessage, withScope } from '@sentry/nextjs';
import { captureMessage, withScope } from '@sentry/nextjs';
import type { AxiosError } from 'axios';
import { isAxiosError } from 'axios';
import { pick } from 'radash';
@ -28,8 +28,7 @@ export async function withHandleError<T>(fn: Promise<T>) {
(Object.keys(opts) as Array<keyof typeof opts>).forEach((key) => {
scope.setExtra(key, JSON.stringify(opts[key]));
});
captureMessage(message);
captureException(error_);
captureMessage(`${error_.message} | ${message}`);
});
throw new Error(message);