(nextResult: unknown)
| 22 | const trpcCaptureContext = { mechanism: { handled: false, type: 'auto.rpc.trpc.middleware' } }; |
| 23 | |
| 24 | function 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 | |
| 37 | type SentryTrpcMiddleware<T> = T extends Promise<unknown> ? T : Promise<T>; |
| 38 |
no test coverage detected