* Captures a manually created event and sends it to Sentry. * * Unlike `captureEvent` exported from every SDK, this method requires that you pass it the current scope.
(event: Event, hint?: EventHint, currentScope?: Scope)
| 347 | * Unlike `captureEvent` exported from every SDK, this method requires that you pass it the current scope. |
| 348 | */ |
| 349 | public captureEvent(event: Event, hint?: EventHint, currentScope?: Scope): string { |
| 350 | const eventId = uuid4(); |
| 351 | |
| 352 | // ensure we haven't captured this very object before |
| 353 | if (hint?.originalException && checkOrSetAlreadyCaught(hint.originalException)) { |
| 354 | DEBUG_BUILD && debug.log(ALREADY_SEEN_ERROR); |
| 355 | return eventId; |
| 356 | } |
| 357 | |
| 358 | const hintWithEventId = { |
| 359 | event_id: eventId, |
| 360 | ...hint, |
| 361 | }; |
| 362 | |
| 363 | const sdkProcessingMetadata = event.sdkProcessingMetadata || {}; |
| 364 | const capturedSpanScope: Scope | undefined = sdkProcessingMetadata.capturedSpanScope; |
| 365 | const capturedSpanIsolationScope: Scope | undefined = sdkProcessingMetadata.capturedSpanIsolationScope; |
| 366 | const dataCategory = getDataCategoryByType(event.type); |
| 367 | |
| 368 | this._process( |
| 369 | () => this._captureEvent(event, hintWithEventId, capturedSpanScope || currentScope, capturedSpanIsolationScope), |
| 370 | dataCategory, |
| 371 | ); |
| 372 | |
| 373 | return hintWithEventId.event_id; |
| 374 | } |
| 375 | |
| 376 | /** |
| 377 | * Captures a session. |
no test coverage detected