MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / getRouteId

Function getRouteId

packages/sveltekit/src/common/utils.ts:25–43  ·  view source on GitHub ↗
(event: EventLike)

Source from the content-addressed store, hash-verified

23 * otherwise falls back to getOwnPropertyDescriptor for SvelteKit 1.x.
24 */
25export function getRouteId(event: EventLike): string | void {
26 if (typeof event.untrack === 'function') {
27 return event.untrack(() => event.route?.id ?? undefined);
28 }
29
30 const route = event.route;
31 if (!route) {
32 return;
33 }
34
35 const descriptor = Object.getOwnPropertyDescriptor(route, 'id');
36 const fromDescriptor = descriptor?.value as string | null | undefined;
37
38 if (fromDescriptor !== undefined && fromDescriptor !== null) {
39 return fromDescriptor;
40 }
41
42 return;
43}
44
45/**
46 * Determines if a thrown "error" is a Redirect object which SvelteKit users can throw to redirect to another route

Callers 4

utils.test.tsFile · 0.90
wrapLoadWithSentryFunction · 0.90
wrapLoadWithSentryFunction · 0.90
wrapServerLoadWithSentryFunction · 0.90

Calls 1

untrackMethod · 0.80

Tested by

no test coverage detected