* Capture a message for this scope. * * @returns {string} The id of the captured message.
(message: string, level?: SeverityLevel, hint?: EventHint)
| 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. |