( this: unknown, origFn: DataFunction, name: string, args: ActionFunctionArgs | LoaderFunctionArgs, span?: Span, )
| 84 | * @returns The wrapped `DataFunction`. |
| 85 | */ |
| 86 | export async function errorHandleDataFunction( |
| 87 | this: unknown, |
| 88 | origFn: DataFunction, |
| 89 | name: string, |
| 90 | args: ActionFunctionArgs | LoaderFunctionArgs, |
| 91 | span?: Span, |
| 92 | ): Promise<Response> { |
| 93 | return handleCallbackErrors( |
| 94 | async () => { |
| 95 | if (name === 'action' && span) { |
| 96 | const client = getClient(); |
| 97 | const options = client?.getOptions() as RemixOptions | undefined; |
| 98 | |
| 99 | if ( |
| 100 | client?.getDataCollectionOptions().httpBodies.includes('incomingRequest') && |
| 101 | options?.captureActionFormDataKeys |
| 102 | ) { |
| 103 | await storeFormDataKeys(args, span, options.captureActionFormDataKeys); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | return origFn.call(this, args); |
| 108 | }, |
| 109 | err => { |
| 110 | // We capture all unexpected errors (except the `Route Error Response`s / Thrown Responses) in `handleError` function. |
| 111 | // This is both for consistency and also avoid duplicates such as primitives like `string` or `number` being captured twice. |
| 112 | if (isResponse(err)) { |
| 113 | // eslint-disable-next-line @typescript-eslint/no-floating-promises |
| 114 | captureRemixServerException(err, name, args.request); |
| 115 | } |
| 116 | |
| 117 | throw err; |
| 118 | }, |
| 119 | ); |
| 120 | } |
| 121 | |
| 122 | async function extractResponseError(response: Response): Promise<unknown> { |
| 123 | const responseData = await extractData(response); |
nothing calls this directly
no test coverage detected