Skip to content

SvelteKit 4XX errors thrown in load functions should not trigger captureException #10568

Closed
@ncvc

Description

@ncvc

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/sveltekit

SDK Version

7.100.1

Framework Version

SvelteKit 2.5.0

Link to Sentry event

https://agent-tax.sentry.io/issues/4905544148/?notification_uuid=3d8bb633-3ad0-4712-ae79-3a44fe73b25c&project=4504771498868736

SDK Setup

Sentry.init({
    dsn: "<dsn>",
    integrations: [
      browserTracingIntegration(),
      captureConsoleIntegration({
        levels: ["warn", "error", "assert"],
      }),
    ],
    release,
    environment: "<environment>",
    // Set tracesSampleRate to 1.0 to capture 100%
    // of transactions for performance monitoring.
    // We recommend adjusting this value in production
    tracesSampleRate: 1.0,
    attachStacktrace: true,
    ignoreErrors: [
      ...
    ],
  });

Steps to Reproduce

Using Sveltekit, throw a 4XX error in the load function for a page, and then navigate to that page via client-side navigation.

In my specific case, I can repro by logging in to my site and opening another tab (both tabs are now logged in). I logout on one of the tabs and then navigate to another page on the other tab. That page's load function hits an API that returns a 403, which is then thrown as a sveltekit error(403). The page is rendered using +error.svelte, but sentry captures the exception.

On the server side sentry ignores 4XX errors, but on the client side it doesn't. I think sentry should ignore 4XX errors on the client side as well, unless I'm missing some reason that these should not be ignored on the client side.

Expected Result

4XX errors are ignored by sentry on the client and server side

Actual Result

4XX errors are ignored by sentry on the server side, but not on the client side.

Metadata

Metadata

Assignees

Labels

Package: sveltekitIssues related to the Sentry SvelteKit SDK

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions