mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-21 00:17:47 +08:00
feat(ql3): establish 3.0 incubation baseline
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import type { RunAttemptStatus, RunStatus } from './run';
|
||||
|
||||
export class RunStateMachineError extends Error {
|
||||
constructor(message: string, public readonly code: string) {
|
||||
super(message);
|
||||
this.name = new.target.name;
|
||||
}
|
||||
}
|
||||
|
||||
export class RunVersionConflictError extends RunStateMachineError {
|
||||
constructor(
|
||||
public readonly runId: string,
|
||||
public readonly expectedVersion: number,
|
||||
public readonly actualVersion: number,
|
||||
) {
|
||||
super(
|
||||
'Run version does not match the expected version',
|
||||
'RUN_VERSION_CONFLICT',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class InvalidRunTransitionError extends RunStateMachineError {
|
||||
constructor(
|
||||
public readonly runId: string,
|
||||
public readonly from: RunStatus,
|
||||
public readonly to: RunStatus,
|
||||
) {
|
||||
super(
|
||||
`Run cannot transition from ${from} to ${to}`,
|
||||
'INVALID_RUN_TRANSITION',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class InvalidRunAttemptTransitionError extends RunStateMachineError {
|
||||
constructor(
|
||||
public readonly attemptId: string,
|
||||
public readonly from: RunAttemptStatus,
|
||||
public readonly to: RunAttemptStatus,
|
||||
) {
|
||||
super(
|
||||
`RunAttempt cannot transition from ${from} to ${to}`,
|
||||
'INVALID_RUN_ATTEMPT_TRANSITION',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class InvalidTransitionTimestampError extends RunStateMachineError {
|
||||
constructor(message: string) {
|
||||
super(message, 'INVALID_TRANSITION_TIMESTAMP');
|
||||
}
|
||||
}
|
||||
|
||||
export class InvalidTransitionMetadataError extends RunStateMachineError {
|
||||
constructor(message: string) {
|
||||
super(message, 'INVALID_TRANSITION_METADATA');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user