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

Function captureMessage

packages/core/src/client.ts:319–342  ·  view source on GitHub ↗

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

(
    message: ParameterizedString,
    level?: SeverityLevel,
    hint?: EventHint,
    currentScope?: Scope,
  )

Source from the content-addressed store, hash-verified

317 * Unlike `captureMessage` exported from every SDK, this method requires that you pass it the current scope.
318 */
319 public captureMessage(
320 message: ParameterizedString,
321 level?: SeverityLevel,
322 hint?: EventHint,
323 currentScope?: Scope,
324 ): string {
325 const hintWithEventId = {
326 event_id: uuid4(),
327 ...hint,
328 };
329
330 const eventMessage = isParameterizedString(message) ? message : String(message);
331 const isMessage = isPrimitive(message);
332 const promisedEvent = isMessage
333 ? this.eventFromMessage(eventMessage, level, hintWithEventId)
334 : this.eventFromException(message, hintWithEventId);
335
336 this._process(
337 () => promisedEvent.then(event => this._captureEvent(event, hintWithEventId, currentScope)),
338 isMessage ? 'unknown' : 'error',
339 );
340
341 return hintWithEventId.event_id;
342 }
343
344 /**
345 * Captures a manually created event and sends it to Sentry.

Callers 3

index.test.tsFile · 0.90
onPinoStartFunction · 0.90
setupTimeoutWarningFunction · 0.50

Calls 6

uuid4Function · 0.90
isParameterizedStringFunction · 0.90
isPrimitiveFunction · 0.90
eventFromMessageMethod · 0.45
eventFromExceptionMethod · 0.45
thenMethod · 0.45

Tested by

no test coverage detected