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
- Create a new sveltekit app.
- Run the sveltekit installation wizard
npx @sentry/wizard@latest -i sveltekit and create the example endpoint that throws an error.
- 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");
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
npx @sentry/wizard@latest -i sveltekitand create the example endpoint that throws an error.Expected Result
I was expecting this error to be caught be cause the documentation of
errorsaysThrows 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");