refactor(cli): split tjwater cli modules
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user