(e: unknown)
| 14 | type PatchedLoadEvent = LoadEvent & Partial<SentryWrappedFlag>; |
| 15 | |
| 16 | function 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 |
nothing calls this directly
no test coverage detected