* Captures an exception event and sends it to Sentry. * * Unlike `captureException` exported from every SDK, this method requires that you pass it the current scope.
(exception: unknown, hint?: EventHint, scope?: Scope)
| 287 | * Unlike `captureException` exported from every SDK, this method requires that you pass it the current scope. |
| 288 | */ |
| 289 | public captureException(exception: unknown, hint?: EventHint, scope?: Scope): string { |
| 290 | const eventId = uuid4(); |
| 291 | |
| 292 | // ensure we haven't captured this very object before |
| 293 | if (checkOrSetAlreadyCaught(exception)) { |
| 294 | DEBUG_BUILD && debug.log(ALREADY_SEEN_ERROR); |
| 295 | return eventId; |
| 296 | } |
| 297 | |
| 298 | const hintWithEventId = { |
| 299 | event_id: eventId, |
| 300 | ...hint, |
| 301 | }; |
| 302 | |
| 303 | this._process( |
| 304 | () => |
| 305 | this.eventFromException(exception, hintWithEventId) |
| 306 | .then(event => this._captureEvent(event, hintWithEventId, scope)) |
| 307 | .then(res => res), |
| 308 | 'error', |
| 309 | ); |
| 310 | |
| 311 | return hintWithEventId.event_id; |
| 312 | } |
| 313 | |
| 314 | /** |
| 315 | * Captures a message event and sends it to Sentry. |
no test coverage detected