/** JSDoc */
private _instrumentFetch()
...
const fetchData: {
method: string;
url: string;
status_code?: number;
} = {
method: isString(method) ? method.toUpperCase() : method,
url,
};
return originalFetch
.apply(global, args)
.then((response: Response) => {
fetchData.status_code = response.status;
Breadcrumbs.addBreadcrumb(
{
category: 'fetch',
data: fetchData,
type: 'http',
},
{
input: args,
response,
},
);
return response;
})
看了一下报错信息是因为Sentry会监听fetch Api的报错
https://github.com/getsentry/sentry-javascript/blob/master/packages/browser/src/integrations/breadcrumbs.ts
主要是这里的
response为undefined,获取status的时候就报错了,然后就出现zanePerfor、Sentry无限报错