MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / errorHandleDataFunction

Function errorHandleDataFunction

packages/remix/src/server/errors.ts:86–120  ·  view source on GitHub ↗
(
  this: unknown,
  origFn: DataFunction,
  name: string,
  args: ActionFunctionArgs | LoaderFunctionArgs,
  span?: Span,
)

Source from the content-addressed store, hash-verified

84 * @returns The wrapped `DataFunction`.
85 */
86export 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
122async function extractResponseError(response: Response): Promise<unknown> {
123 const responseData = await extractData(response);

Callers

nothing calls this directly

Calls 6

handleCallbackErrorsFunction · 0.90
getClientFunction · 0.90
storeFormDataKeysFunction · 0.90
callMethod · 0.80
getOptionsMethod · 0.65

Tested by

no test coverage detected