Skip to content

Conversation

@AbhiPrasad
Copy link
Member

@AbhiPrasad AbhiPrasad commented Mar 10, 2023

ref #7403

Adds a wrapper for the server-side handleError hook.

Usage is like the following:

src/hooks.server.js

import { handleErrorWithSentry } from '@sentry/sveltekit';

/** @type {import('@sveltejs/kit').HandleServerError} */
function myCustomHandleError() {
 ...
}

// myCustomHandleError is optional
export const handleError = handleErrorWithSentry(myCustomHandleError);

In #7406 I introduced this functionality on the client side.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.24 KB (+0.11% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 62.95 KB (+0.11% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.87 KB (+0.1% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 55.87 KB (+0.12% 🔺)
@sentry/browser - Webpack (gzipped + minified) 20.62 KB (+0.12% 🔺)
@sentry/browser - Webpack (minified) 67.39 KB (+0.1% 🔺)
@sentry/react - Webpack (gzipped + minified) 20.65 KB (+0.12% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 48.54 KB (+0.18% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 27.51 KB (+0.23% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.76 KB (+0.21% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43.17 KB (0%)
@sentry/replay - Webpack (gzipped + minified) 37.19 KB (0%)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 61.18 KB (+0.09% 🔺)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 54.35 KB (+0.04% 🔺)

@AbhiPrasad
Copy link
Member Author

In e9d8904 I added two additional changes

  1. Renamed wrapHandleErrorWithSentry to handleErrorWithSentry
  2. Made the passing of a custom handleError implementation optional

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! 🔥

import type { HandleClientError, NavigationEvent } from '@sveltejs/kit';

import { wrapHandleError } from '../../src/client/handleError';
import { wrapHandleErrorWithSentry } from '../../src/client/handleError';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: this needs to be updated I guess 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! good catch.

@AbhiPrasad AbhiPrasad merged commit ed1347e into develop Mar 10, 2023
@AbhiPrasad AbhiPrasad deleted the abhi-sveltekit-server-handle-error branch March 10, 2023 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants