mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Delete setupFetchDebugging.js (#10636)
* Delete setupFetchDebugging.js * remove fetch-debugging (now handled corrently by sentry)
This commit is contained in:
parent
91e5b85955
commit
bfdc1e68f5
@ -1,12 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @file The entry point for the web extension singleton process.
|
* @file The entry point for the web extension singleton process.
|
||||||
*/
|
*/
|
||||||
// these need to run before anything else
|
|
||||||
/* eslint-disable import/first,import/order */
|
|
||||||
import setupFetchDebugging from './lib/setupFetchDebugging';
|
|
||||||
/* eslint-enable import/order */
|
|
||||||
|
|
||||||
setupFetchDebugging();
|
|
||||||
|
|
||||||
// polyfills
|
// polyfills
|
||||||
import 'abortcontroller-polyfill/dist/polyfill-patch-fetch';
|
import 'abortcontroller-polyfill/dist/polyfill-patch-fetch';
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
//
|
|
||||||
// This is a utility to help resolve cases where `window.fetch` throws a
|
|
||||||
// `TypeError: Failed to Fetch` without any stack or context for the request
|
|
||||||
// https://github.com/getsentry/sentry-javascript/pull/1293
|
|
||||||
//
|
|
||||||
|
|
||||||
export default function setupFetchDebugging() {
|
|
||||||
if (!window.fetch) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const originalFetch = window.fetch;
|
|
||||||
|
|
||||||
window.fetch = wrappedFetch;
|
|
||||||
|
|
||||||
async function wrappedFetch(...args) {
|
|
||||||
const initialStack = getCurrentStack();
|
|
||||||
try {
|
|
||||||
return await originalFetch.call(window, ...args);
|
|
||||||
} catch (err) {
|
|
||||||
if (!err.stack) {
|
|
||||||
console.warn(
|
|
||||||
'FetchDebugger - fetch encountered an Error without a stack',
|
|
||||||
err,
|
|
||||||
);
|
|
||||||
console.warn(
|
|
||||||
'FetchDebugger - overriding stack to point of original call',
|
|
||||||
);
|
|
||||||
err.stack = initialStack;
|
|
||||||
}
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCurrentStack() {
|
|
||||||
try {
|
|
||||||
throw new Error('Fake error for generating stack trace');
|
|
||||||
} catch (err) {
|
|
||||||
return err.stack;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user