/** * Stable, machine-readable error codes printed by `--json`. * Changing or removing a code is a breaking change. */ export declare const ErrorCodes: { readonly invalidArgument: "INVALID_ARGUMENT"; readonly inputNotFound: "INPUT_NOT_FOUND"; readonly inputParseError: "INPUT_PARSE_ERROR"; readonly clientGenerationFailed: "CLIENT_GENERATION_FAILED"; readonly generationFailed: "GENERATION_FAILED"; readonly outputOutOfDate: "OUTPUT_OUT_OF_DATE"; }; export type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes]; export declare const ExitCodes: { readonly success: 0; readonly outOfDate: 1; readonly error: 2; }; export type ErrorDetails = Record; export declare class CodegenError extends Error { readonly code: ErrorCode; readonly details: ErrorDetails; constructor(code: ErrorCode, message: string, details?: ErrorDetails, options?: { cause?: unknown; }); } /** * Anything that is not already a {@link CodegenError} is an unexpected * failure in our own pipeline. */ export declare function toCodegenError(error: unknown): CodegenError; export type JsonError = { code: ErrorCode; message: string; details: ErrorDetails; }; export declare function toJsonError(error: CodegenError): JsonError; export declare function formatErrorJson(error: CodegenError): string; /** * Human-readable rendering for the default (non-JSON) mode. * Unexpected failures keep their stack trace so they stay debuggable. */ export declare function formatErrorText(error: CodegenError): string;