mirror of
https://github.com/MarSeventh/CloudFlare-ImgBed.git
synced 2026-04-26 23:25:11 +00:00
init
This commit is contained in:
49
node_modules/@sentry/utils/esm/instrument/globalError.js
generated
vendored
Normal file
49
node_modules/@sentry/utils/esm/instrument/globalError.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import { GLOBAL_OBJ } from '../worldwide.js';
|
||||
import { addHandler, maybeInstrument, triggerHandlers } from './_handlers.js';
|
||||
|
||||
let _oldOnErrorHandler = null;
|
||||
|
||||
/**
|
||||
* Add an instrumentation handler for when an error is captured by the global error handler.
|
||||
*
|
||||
* Use at your own risk, this might break without changelog notice, only used internally.
|
||||
* @hidden
|
||||
*/
|
||||
function addGlobalErrorInstrumentationHandler(handler) {
|
||||
const type = 'error';
|
||||
addHandler(type, handler);
|
||||
maybeInstrument(type, instrumentError);
|
||||
}
|
||||
|
||||
function instrumentError() {
|
||||
_oldOnErrorHandler = GLOBAL_OBJ.onerror;
|
||||
|
||||
GLOBAL_OBJ.onerror = function (
|
||||
msg,
|
||||
url,
|
||||
line,
|
||||
column,
|
||||
error,
|
||||
) {
|
||||
const handlerData = {
|
||||
column,
|
||||
error,
|
||||
line,
|
||||
msg,
|
||||
url,
|
||||
};
|
||||
triggerHandlers('error', handlerData);
|
||||
|
||||
if (_oldOnErrorHandler && !_oldOnErrorHandler.__SENTRY_LOADER__) {
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
return _oldOnErrorHandler.apply(this, arguments);
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
GLOBAL_OBJ.onerror.__SENTRY_INSTRUMENTED__ = true;
|
||||
}
|
||||
|
||||
export { addGlobalErrorInstrumentationHandler };
|
||||
//# sourceMappingURL=globalError.js.map
|
||||
Reference in New Issue
Block a user