MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / addExceptionMechanism

Function addExceptionMechanism

packages/core/src/utils/misc.ts:109–123  ·  view source on GitHub ↗
(event: Event, newMechanism?: Partial<Mechanism>)

Source from the content-addressed store, hash-verified

107 * @hidden
108 */
109export function addExceptionMechanism(event: Event, newMechanism?: Partial<Mechanism>): void {
110 const firstException = getFirstException(event);
111 if (!firstException) {
112 return;
113 }
114
115 const defaultMechanism = { type: 'generic', handled: true };
116 const currentMechanism = firstException.mechanism;
117 firstException.mechanism = { ...defaultMechanism, ...currentMechanism, ...newMechanism };
118
119 if (newMechanism && 'data' in newMechanism) {
120 const mergedData = { ...currentMechanism?.data, ...newMechanism.data };
121 firstException.mechanism.data = mergedData;
122 }
123}
124
125// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
126const SEMVER_REGEXP =

Callers 15

markEventUnhandledFunction · 0.90
misc.test.tsFile · 0.90
prepareEventFunction · 0.90
eventFromUnknownInputFunction · 0.90
eventFromMessageFunction · 0.90
applyFunction · 0.90
consoleHandlerFunction · 0.90
onPinoStartFunction · 0.90
markEventUnhandledFunction · 0.90
eventFromExceptionFunction · 0.85
eventFromUnknownInputFunction · 0.85

Calls 1

getFirstExceptionFunction · 0.85

Tested by

no test coverage detected