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

Function captureException

packages/core/src/client.ts:289–312  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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.

Callers 15

index.test.tsFile · 0.90
captureErrorHookFunction · 0.90
annotateSpanErrorFunction · 0.90
handleFastifyErrorFunction · 0.90
captureToolErrorFunction · 0.90
withElysiaFunction · 0.90
metadata.test.tsFile · 0.90
reportNuxtErrorFunction · 0.90
handleSpanStartFunction · 0.90
applyFunction · 0.90

Calls 5

uuid4Function · 0.90
checkOrSetAlreadyCaughtFunction · 0.90
logMethod · 0.65
thenMethod · 0.45
eventFromExceptionMethod · 0.45

Tested by

no test coverage detected