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

Method setContext

packages/core/src/scope.ts:457–467  ·  view source on GitHub ↗

* Sets context data with the given name. * Data passed as context will be normalized. You can also pass `null` to unset the context. * Note that context data will not be merged - calling `setContext` will overwrite an existing context with the same key.

(key: string, context: Context | null)

Source from the content-addressed store, hash-verified

455 * Note that context data will not be merged - calling `setContext` will overwrite an existing context with the same key.
456 */
457 public setContext(key: string, context: Context | null): this {
458 if (context === null) {
459 // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
460 delete this._contexts[key];
461 } else {
462 this._contexts[key] = context;
463 }
464
465 this._notifyScopeListeners();
466 return this;
467 }
468
469 /**
470 * Set the session for the scope.

Callers 15

_beginProfilingMethod · 0.80
_endProfilingMethod · 0.80
_resetProfilerInfoMethod · 0.80
startProfileForSpanFunction · 0.80
sentryWrapReducerFunction · 0.80
captureToolErrorFunction · 0.80
_wrapEventFunctionFunction · 0.80
_wrapCloudEventFunctionFunction · 0.80
scope.test.tsFile · 0.80

Calls 1

_notifyScopeListenersMethod · 0.95

Tested by

no test coverage detected