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

Method captureMessage

packages/core/src/scope.ts:719–742  ·  view source on GitHub ↗

* Capture a message for this scope. * * @returns {string} The id of the captured message.

(message: string, level?: SeverityLevel, hint?: EventHint)

Source from the content-addressed store, hash-verified

717 * @returns {string} The id of the captured message.
718 */
719 public captureMessage(message: string, level?: SeverityLevel, hint?: EventHint): string {
720 const eventId = hint?.event_id || uuid4();
721
722 if (!this._client) {
723 DEBUG_BUILD && debug.warn('No client configured on scope - will not capture message!');
724 return eventId;
725 }
726
727 const syntheticException = hint?.syntheticException ?? new Error(message);
728
729 this._client.captureMessage(
730 message,
731 level,
732 {
733 originalException: message,
734 syntheticException,
735 ...hint,
736 event_id: eventId,
737 },
738 this,
739 );
740
741 return eventId;
742 }
743
744 /**
745 * Capture a Sentry event for this scope.

Callers 15

scope.test.tsFile · 0.80
client.test.tsFile · 0.80
captureMessageFunction · 0.80
consoleHandlerFunction · 0.80
mod.test.tsFile · 0.80
request.test.tsFile · 0.80
queueFunction · 0.80
emailFunction · 0.80
tailFunction · 0.80
scheduledFunction · 0.80

Calls 2

uuid4Function · 0.90
warnMethod · 0.65

Tested by 4

queueFunction · 0.64
emailFunction · 0.64
tailFunction · 0.64
scheduledFunction · 0.64