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

Function sendErrorToSentry

packages/sveltekit/src/client/load.ts:16–38  ·  view source on GitHub ↗
(e: unknown)

Source from the content-addressed store, hash-verified

14type PatchedLoadEvent = LoadEvent & Partial<SentryWrappedFlag>;
15
16function sendErrorToSentry(e: unknown): unknown {
17 // In case we have a primitive, wrap it in the equivalent wrapper class (string -> String, etc.) so that we can
18 // store a seen flag on it.
19 const objectifiedErr = objectify(e);
20
21 // We don't want to capture thrown `Redirect`s as these are not errors but expected behaviour
22 // Neither 4xx errors, given that they are not valuable.
23 if (
24 isRedirect(objectifiedErr) ||
25 (isHttpError(objectifiedErr) && objectifiedErr.status < 500 && objectifiedErr.status >= 400)
26 ) {
27 return objectifiedErr;
28 }
29
30 captureException(objectifiedErr, {
31 mechanism: {
32 type: 'auto.function.sveltekit.load',
33 handled: false,
34 },
35 });
36
37 return objectifiedErr;
38}
39
40/**
41 * Wrap load function with Sentry. This wrapper will

Callers

nothing calls this directly

Calls 4

objectifyFunction · 0.90
isRedirectFunction · 0.90
isHttpErrorFunction · 0.90
captureExceptionFunction · 0.50

Tested by

no test coverage detected