(status: number, message: string, path?: string)
| 91 | retryable: clientError.retryable, |
| 92 | clientError, |
| 93 | ...(billingFailure ? { billingFailure } : {}), |
| 94 | }; |
| 95 | } |
| 96 | return { |
| 97 | ...data, |
| 98 | clientError: createClientError(data.code, message), |
| 99 | ...(billingFailure ? { billingFailure } : {}), |
| 100 | }; |
| 101 | } |
| 102 | |
| 103 | type BuildTrpcErrorResponseOptions = { retryable?: boolean }; |
| 104 | |
| 105 | export function buildTrpcErrorResponse( |
| 106 | status: number, |
| 107 | message: string, |
| 108 | path?: string, |
| 109 | options: BuildTrpcErrorResponseOptions = {} |
| 110 | ): Response { |
| 111 | const code = |
| 112 | STATUS_TO_TRPC_CODE[status as keyof typeof STATUS_TO_TRPC_CODE] ?? 'INTERNAL_SERVER_ERROR'; |
| 113 | const data = projectTrpcErrorData({ code, httpStatus: status, path }, message); |
no test coverage detected