Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ export function register() {
});
}
}

export const onRequestError = Sentry.captureRequestError;
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ export function register() {
});
}
}

export const onRequestError = Sentry.captureRequestError;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export async function register() {
}
}

export const onRequestError = Sentry.experimental_captureRequestError;
export const onRequestError = Sentry.captureRequestError;
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ export function register() {
});
}
}

export const onRequestError = Sentry.captureRequestError;
20 changes: 10 additions & 10 deletions packages/nextjs/src/common/captureRequestError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,9 @@ type ErrorContext = {
};

/**
* Reports errors for the Next.js `onRequestError` instrumentation hook.
*
* Notice: This function is experimental and not intended for production use. Breaking changes may be done to this funtion in any release.
*
* @experimental
* Reports errors passed to the the Next.js `onRequestError` instrumentation hook.
*/
export function experimental_captureRequestError(
error: unknown,
request: RequestInfo,
errorContext: ErrorContext,
): void {
export function captureRequestError(error: unknown, request: RequestInfo, errorContext: ErrorContext): void {
withScope(scope => {
scope.setSDKProcessingMetadata({
request: {
Expand All @@ -48,3 +40,11 @@ export function experimental_captureRequestError(
});
});
}

/**
* Reports errors passed to the the Next.js `onRequestError` instrumentation hook.
*
* @deprecated Use `captureRequestError` instead.
*/
// TODO(v9): Remove this export
export const experimental_captureRequestError = captureRequestError;
3 changes: 2 additions & 1 deletion packages/nextjs/src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export { wrapMiddlewareWithSentry } from './wrapMiddlewareWithSentry';
export { wrapPageComponentWithSentry } from './wrapPageComponentWithSentry';
export { wrapGenerationFunctionWithSentry } from './wrapGenerationFunctionWithSentry';
export { withServerActionInstrumentation } from './withServerActionInstrumentation';
export { experimental_captureRequestError } from './captureRequestError';
// eslint-disable-next-line deprecation/deprecation
export { experimental_captureRequestError, captureRequestError } from './captureRequestError';
3 changes: 2 additions & 1 deletion packages/nextjs/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,5 @@ export declare function wrapApiHandlerWithSentryVercelCrons<F extends (...args:
*/
export declare function wrapPageComponentWithSentry<C>(WrappingTarget: C): C;

export { experimental_captureRequestError } from './common/captureRequestError';
// eslint-disable-next-line deprecation/deprecation
export { experimental_captureRequestError, captureRequestError } from './common/captureRequestError';
Loading