Skip to content

Sveltekit errors are not captured by sentry #13224

Closed
@Wizzel1

Description

@Wizzel1

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

8.22.0

Framework Version

"@sveltejs/kit": "^2.5.20",

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

  1. Create a new sveltekit app.
  2. Run the sveltekit installation wizard npx @sentry/wizard@latest -i sveltekit and create the example endpoint that throws an error.
  3. Change the code in the example endpoint to:
// This is just a very simple API route that throws an example error.
// Feel free to delete this file and the entire sentry route.
import { error } from '@sveltejs/kit';

export const GET = async () => {
  error(500, 'Sentry Example API Route Error');
};

Expected Result

I was expecting this error to be caught be cause the documentation of error says

Throws an error with a HTTP status code and an optional message. When called during request handling, this will cause SvelteKit to return an error response without invoking handleError. Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it."

Actual Result

No event showed up in sentry. It only works when I use throw new Error("Sentry Example API Route Error");

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: sveltekitIssues related to the Sentry SvelteKit SDK

    Type

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions