mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
1 line
10 KiB
JSON
1 line
10 KiB
JSON
|
|
{"ast":null,"code":"import { isError, normalize, isPlainObject, addNonEnumerableProperty, logger } from '@sentry/utils';\n\n/** JSDoc */\n\n/** Patch toString calls to return proper name for wrapped functions */\nclass ExtraErrorData {\n /**\n * @inheritDoc\n */\n static __initStatic() {\n this.id = 'ExtraErrorData';\n }\n\n /**\n * @inheritDoc\n */\n __init() {\n this.name = ExtraErrorData.id;\n }\n\n /** JSDoc */\n\n /**\n * @inheritDoc\n */\n constructor(options) {\n ;\n ExtraErrorData.prototype.__init.call(this);\n this._options = {\n depth: 3,\n ...options\n };\n }\n\n /**\n * @inheritDoc\n */\n setupOnce(addGlobalEventProcessor, getCurrentHub) {\n addGlobalEventProcessor((event, hint) => {\n var self = getCurrentHub().getIntegration(ExtraErrorData);\n if (!self) {\n return event;\n }\n return self.enhanceEventWithErrorData(event, hint);\n });\n }\n\n /**\n * Attaches extracted information from the Error object to extra field in the Event\n */\n enhanceEventWithErrorData(event, hint = {}) {\n if (!hint.originalException || !isError(hint.originalException)) {\n return event;\n }\n var exceptionName = hint.originalException.name || hint.originalException.constructor.name;\n var errorData = this._extractErrorData(hint.originalException);\n if (errorData) {\n var contexts = {\n ...event.contexts\n };\n var normalizedErrorData = normalize(errorData, this._options.depth);\n if (isPlainObject(normalizedErrorData)) {\n // We mark the error data as \"already normalized\" here, because we don't want other normalization procedures to\n // potentially truncate the data we just already normalized, with a certain depth setting.\n addNonEnumerableProperty(normalizedErrorData, '__sentry_skip_normalization__', true);\n contexts[exceptionName] = normalizedErrorData;\n }\n return {\n ...event,\n contexts\n };\n }\n return event;\n }\n\n /**\n * Extract extra information from the Error object\n */\n _extractErrorData(error) {\n // We are trying to enhance already existing event, so no harm done if it won't succeed\n try {\n var nativeKeys = ['name', 'message', 'stack', 'line', 'column', 'fileName', 'lineNumber', 'columnNumber', 'toJSON'];\n var extraErrorInfo = {};\n\n // We want only enumerable properties, thus `getOwnPropertyNames` is redundant here, as we filter keys anyway.\n for (var key of Object.keys(error)) {\n if (nativeKeys.indexOf(key) !== -1) {\n continue;\n }\n var value = error[key];\n extraErrorInfo[key] = isError(value) ? value.toString() : value;\n }\n\n // Check if someone attached `toJSON` method to grab even more properties (eg. axios is doing that)\n if (typeof error.toJSON === 'function') {\n var serializedError = error.toJSON();\n for (var key of Object.keys(serializedError)) {\n var value = serializedError[key];\n extraErrorInfo[key] = isError(value) ? value.toString() : value;\n }\n }\n return extraErrorInfo;\n } catch (oO) {\n (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.error('Unable to extract extra data from the Error object:', oO);\n }\n return null;\n }\n}\nExtraErrorData.__initStatic();\nexport { ExtraErrorData };","map":{"version":3,"names":["isError","normalize","isPlainObject","addNonEnumerableProperty","logger","ExtraErrorData","__initStatic","id","__init","name","constructor","options","prototype","call","_options","depth","setupOnce","addGlobalEventProcessor","getCurrentHub","event","hint","self","getIntegration","enhanceEventWithErrorData","originalException","exceptionName","errorData","_extractErrorData","contexts","normalizedErrorData","error","nativeKeys","extraErrorInfo","key","Object","keys","indexOf","value","toString","toJSON","serializedError","oO","__SENTRY_DEBUG__"],"sources":["C:/Users/eudes.inacio/GabineteDig
|