export class TerminalError extends Error {
context?: any;
constructor(message: string, context?: any) {
super(message);
this.context = context;
this.name = this.constructor.name;
if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
}
}
export class CommandExecutionError extends TerminalError {
exitCode: number;
constructor(message: string, exitCode: number, context?: any) {
super(message, context);
this.exitCode = exitCode;
}
}
export class SecurityError extends TerminalError {
offendingCommand?: string;
constructor(message: string, offendingCommand?: string) {
super(message, { offendingCommand });
}
}
export class TimeoutError extends TerminalError {
timeoutMs: number;
constructor(message: string, timeoutMs: number) {
super(message, { timeoutMs });
this.timeoutMs = timeoutMs;
}
}
export class ValidationError extends TerminalError {
details?: any;
constructor(message: string, details?: any) {
super(message, details);
}
}