|
1 | | -import type { |
2 | | - ActionFunction, |
3 | | - ActionFunctionArgs, |
4 | | - EntryContext, |
5 | | - HandleDocumentRequestFunction, |
6 | | - LoaderFunction, |
7 | | - LoaderFunctionArgs, |
8 | | -} from '@remix-run/node'; |
| 1 | +import type { ActionFunction, ActionFunctionArgs, LoaderFunction, LoaderFunctionArgs } from '@remix-run/node'; |
9 | 2 | import { isRouteErrorResponse } from '@remix-run/router'; |
10 | 3 | import type { RequestEventData, Span } from '@sentry/core'; |
11 | 4 | import { |
@@ -79,36 +72,6 @@ export async function captureRemixServerException(err: unknown, name: string, re |
79 | 72 | }); |
80 | 73 | } |
81 | 74 |
|
82 | | -/** |
83 | | - * Wraps the original `HandleDocumentRequestFunction` with error handling. |
84 | | - * |
85 | | - * @param origDocumentRequestFunction The original `HandleDocumentRequestFunction`. |
86 | | - * @param requestContext The request context. |
87 | | - * |
88 | | - * @returns The wrapped `HandleDocumentRequestFunction`. |
89 | | - */ |
90 | | -export function errorHandleDocumentRequestFunction( |
91 | | - this: unknown, |
92 | | - origDocumentRequestFunction: HandleDocumentRequestFunction, |
93 | | - requestContext: { |
94 | | - request: Request; |
95 | | - responseStatusCode: number; |
96 | | - responseHeaders: Headers; |
97 | | - context: EntryContext; |
98 | | - loadContext?: Record<string, unknown>; |
99 | | - }, |
100 | | -): HandleDocumentRequestFunction { |
101 | | - const { request, responseStatusCode, responseHeaders, context, loadContext } = requestContext; |
102 | | - |
103 | | - return handleCallbackErrors( |
104 | | - () => origDocumentRequestFunction.call(this, request, responseStatusCode, responseHeaders, context, loadContext), |
105 | | - err => { |
106 | | - // eslint-disable-next-line @typescript-eslint/no-floating-promises |
107 | | - captureRemixServerException(err, 'HandleDocumentRequestFunction', request); |
108 | | - }, |
109 | | - ); |
110 | | -} |
111 | | - |
112 | 75 | /** |
113 | 76 | * Wraps the original `DataFunction` with error handling. |
114 | 77 | * This function also stores the form data keys if the action is being called. |
|
0 commit comments