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

Function captureIfError

packages/core/src/trpc.ts:24–35  ·  view source on GitHub ↗
(nextResult: unknown)

Source from the content-addressed store, hash-verified

22const trpcCaptureContext = { mechanism: { handled: false, type: 'auto.rpc.trpc.middleware' } };
23
24function captureIfError(nextResult: unknown): void {
25 // TODO: Set span status based on what TRPCError was encountered
26 if (
27 typeof nextResult === 'object' &&
28 nextResult !== null &&
29 'ok' in nextResult &&
30 !nextResult.ok &&
31 'error' in nextResult
32 ) {
33 captureException(nextResult.error, trpcCaptureContext);
34 }
35}
36
37type SentryTrpcMiddleware<T> = T extends Promise<unknown> ? T : Promise<T>;
38

Callers 1

trpcMiddlewareFunction · 0.85

Calls 1

captureExceptionFunction · 0.90

Tested by

no test coverage detected