Files
TJWaterAgent/cli/src/core/errors.ts
T
jiang 93d70da8be
Agent CI/CD / deploy-fallback-log (push) Has been cancelled
Agent CI/CD / docker-image (push) Has been cancelled
refactor(cli): split tjwater cli modules
2026-06-07 19:43:44 +08:00

32 lines
662 B
TypeScript

export class CliError extends Error {
summary: string;
code: string;
exitCode: number;
retryable: boolean;
data: unknown;
nextCommands: string[];
constructor(
summary: string,
code: string,
message: string,
exitCode = 2,
retryable = false,
data: unknown = null,
nextCommands: string[] = [],
) {
super(message);
this.summary = summary;
this.code = code;
this.exitCode = exitCode;
this.retryable = retryable;
this.data = data;
this.nextCommands = nextCommands;
}
}
export function errorMessage(error: unknown): string {
return error instanceof Error ? error.message : String(error);
}