Skip to content

Commit 0ac0c83

Browse files
committed
cleanup
1 parent 9617647 commit 0ac0c83

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

packages/sveltekit/src/server/handle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable @sentry-internal/sdk/no-optional-chaining */
22
import type { Span } from '@sentry/core';
3-
import { flush, getActiveTransaction, getCurrentHub, runWithAsyncContext, startSpan } from '@sentry/core';
3+
import { getActiveTransaction, getCurrentHub, runWithAsyncContext, startSpan } from '@sentry/core';
44
import { captureException } from '@sentry/node';
55
import { addExceptionMechanism, dynamicSamplingContextToSentryBaggageHeader, objectify } from '@sentry/utils';
66
import type { Handle, ResolveOptions } from '@sveltejs/kit';

packages/sveltekit/src/server/load.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @sentry-internal/sdk/no-optional-chaining */
2-
import { flush, getCurrentHub, startSpan, trace } from '@sentry/core';
2+
import { flush, getCurrentHub, startSpan } from '@sentry/core';
33
import { captureException } from '@sentry/node';
44
import type { TransactionContext } from '@sentry/types';
55
import { addExceptionMechanism, addNonEnumerableProperty, objectify } from '@sentry/utils';
@@ -81,8 +81,8 @@ export function wrapLoadWithSentry<T extends (...args: any) => any>(origLoad: T)
8181
};
8282

8383
try {
84-
const loadResult = await startSpan(traceLoadContext, () => wrappingTarget.apply(thisArg, args));
85-
return loadResult;
84+
// We need to await before returning, otherwise we won't catch any errors thrown by the load function
85+
return await startSpan(traceLoadContext, () => wrappingTarget.apply(thisArg, args));
8686
} catch (e) {
8787
sendErrorToSentry(e);
8888
throw e;
@@ -153,8 +153,8 @@ export function wrapServerLoadWithSentry<T extends (...args: any) => any>(origSe
153153
};
154154

155155
try {
156-
const serverLoadResult = await startSpan(traceLoadContext, () => wrappingTarget.apply(thisArg, args));
157-
return serverLoadResult;
156+
// We need to await before returning, otherwise we won't catch any errors thrown by the load function
157+
return await startSpan(traceLoadContext, () => wrappingTarget.apply(thisArg, args));
158158
} catch (e: unknown) {
159159
sendErrorToSentry(e);
160160
throw e;

0 commit comments

Comments
 (0)