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

Function captureEvent

packages/core/src/client.ts:349–374  ·  view source on GitHub ↗

* Captures a manually created event and sends it to Sentry. * * Unlike `captureEvent` exported from every SDK, this method requires that you pass it the current scope.

(event: Event, hint?: EventHint, currentScope?: Scope)

Source from the content-addressed store, hash-verified

347 * Unlike `captureEvent` exported from every SDK, this method requires that you pass it the current scope.
348 */
349 public captureEvent(event: Event, hint?: EventHint, currentScope?: Scope): string {
350 const eventId = uuid4();
351
352 // ensure we haven't captured this very object before
353 if (hint?.originalException && checkOrSetAlreadyCaught(hint.originalException)) {
354 DEBUG_BUILD && debug.log(ALREADY_SEEN_ERROR);
355 return eventId;
356 }
357
358 const hintWithEventId = {
359 event_id: eventId,
360 ...hint,
361 };
362
363 const sdkProcessingMetadata = event.sdkProcessingMetadata || {};
364 const capturedSpanScope: Scope | undefined = sdkProcessingMetadata.capturedSpanScope;
365 const capturedSpanIsolationScope: Scope | undefined = sdkProcessingMetadata.capturedSpanIsolationScope;
366 const dataCategory = getDataCategoryByType(event.type);
367
368 this._process(
369 () => this._captureEvent(event, hintWithEventId, capturedSpanScope || currentScope, capturedSpanIsolationScope),
370 dataCategory,
371 );
372
373 return hintWithEventId.event_id;
374 }
375
376 /**
377 * Captures a session.

Callers 10

index.test.tsFile · 0.90
hint.test.tsFile · 0.90
_maybeSendMethod · 0.90
_fetchResponseHandlerFunction · 0.50
_xhrResponseHandlerFunction · 0.50

Calls 4

uuid4Function · 0.90
checkOrSetAlreadyCaughtFunction · 0.90
getDataCategoryByTypeFunction · 0.85
logMethod · 0.65

Tested by

no test coverage detected