mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-21 00:38:14 +08:00
34 lines
925 B
TypeScript
34 lines
925 B
TypeScript
import type { RunAttemptStatus } from '../domain/run';
|
|
|
|
export class RunCommandError extends Error {
|
|
constructor(message: string, public readonly code: string) {
|
|
super(message);
|
|
this.name = new.target.name;
|
|
}
|
|
}
|
|
|
|
export class RunNotFoundError extends RunCommandError {
|
|
constructor(public readonly runId: string) {
|
|
super('Run does not exist', 'RUN_NOT_FOUND');
|
|
}
|
|
}
|
|
|
|
export class RunAttemptNotFoundError extends RunCommandError {
|
|
constructor(public readonly attemptId: string) {
|
|
super('RunAttempt does not exist', 'RUN_ATTEMPT_NOT_FOUND');
|
|
}
|
|
}
|
|
|
|
export class RunAttemptConcurrentWriteError extends RunCommandError {
|
|
constructor(
|
|
public readonly attemptId: string,
|
|
public readonly expectedStatus: RunAttemptStatus,
|
|
public readonly expectedCallbackSequence: number,
|
|
) {
|
|
super(
|
|
'RunAttempt changed while applying the command',
|
|
'RUN_ATTEMPT_CONCURRENT_WRITE',
|
|
);
|
|
}
|
|
}
|