utils/axios: fix exception message
This commit is contained in:
parent
d377db0cc0
commit
a47e08a286
@ -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<T>(fn: Promise<T>) {
|
||||
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<keyof typeof opts>).forEach((key) => {
|
||||
scope.setExtra(key, JSON.stringify(opts[key]));
|
||||
});
|
||||
captureMessage(message);
|
||||
captureException(error_);
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user