MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / projectTrpcErrorData

Function projectTrpcErrorData

services/cloud-agent-next/src/trpc-error.ts:72–91  ·  view source on GitHub ↗
(
  data: TrpcErrorData,
  message: string,
  cause?: unknown
)

Source from the content-addressed store, hash-verified

70
71export function createClientError(code: string, message: string, retryable?: boolean): ClientError {
72 return {
73 code,
74 message,
75 retryable: NON_RETRYABLE_CODES.has(code) ? false : (retryable ?? true),
76 };
77}
78
79export function projectTrpcErrorData(
80 data: TrpcErrorData,
81 message: string,
82 cause?: unknown
83): TrpcErrorData & { clientError: ClientError } {
84 const explicitCause = parseExplicitLegacyCause(cause);
85 const billingFailure = parseBillingFailure(cause);
86 if (explicitCause) {
87 const clientError = createClientError(explicitCause.error, message, explicitCause.retryable);
88 return {
89 ...data,
90 error: explicitCause.error,
91 retryable: clientError.retryable,
92 clientError,
93 ...(billingFailure ? { billingFailure } : {}),
94 };

Callers 3

trpc-error.test.tsFile · 0.85
buildTrpcErrorResponseFunction · 0.85
errorFormatterFunction · 0.85

Calls 2

parseExplicitLegacyCauseFunction · 0.85
createClientErrorFunction · 0.85

Tested by

no test coverage detected