* Capture an exception for this scope. * * @returns {string} The id of the captured Sentry event.
(exception: unknown, hint?: EventHint)
| 688 | * @returns {string} The id of the captured Sentry event. |
| 689 | */ |
| 690 | public captureException(exception: unknown, hint?: EventHint): string { |
| 691 | const eventId = hint?.event_id || uuid4(); |
| 692 | |
| 693 | if (!this._client) { |
| 694 | DEBUG_BUILD && debug.warn('No client configured on scope - will not capture exception!'); |
| 695 | return eventId; |
| 696 | } |
| 697 | |
| 698 | const syntheticException = new Error('Sentry syntheticException'); |
| 699 | |
| 700 | this._client.captureException( |
| 701 | exception, |
| 702 | { |
| 703 | originalException: exception, |
| 704 | syntheticException, |
| 705 | ...hint, |
| 706 | event_id: eventId, |
| 707 | }, |
| 708 | this, |
| 709 | ); |
| 710 | |
| 711 | return eventId; |
| 712 | } |
| 713 | |
| 714 | /** |
| 715 | * Capture a message for this scope. |
no test coverage detected