Skip to content

Commit 8ee4aae

Browse files
d-csclaude
andcommitted
feat(run-engine): typed ExecutionSnapshotNotFoundError from getExecutionSnapshotsSince
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent a38571e commit 8ee4aae

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

internal-packages/run-engine/src/engine/errors.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,10 @@ export class RunOneTimeUseTokenError extends Error {
104104
this.name = "RunOneTimeUseTokenError";
105105
}
106106
}
107+
108+
export class ExecutionSnapshotNotFoundError extends Error {
109+
constructor(public readonly snapshotId: string) {
110+
super(`No execution snapshot found for id ${snapshotId}`);
111+
this.name = "ExecutionSnapshotNotFoundError";
112+
}
113+
}

internal-packages/run-engine/src/engine/systems/executionSnapshotSystem.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
TaskRunStatus,
1111
Waitpoint,
1212
} from "@trigger.dev/database";
13+
import { ExecutionSnapshotNotFoundError } from "../errors.js";
1314
import { HeartbeatTimeouts } from "../types.js";
1415
import { SystemResources } from "./systems.js";
1516

@@ -278,7 +279,7 @@ export async function getExecutionSnapshotsSince(
278279
});
279280

280281
if (!sinceSnapshot) {
281-
throw new Error(`No execution snapshot found for id ${sinceSnapshotId}`);
282+
throw new ExecutionSnapshotNotFoundError(sinceSnapshotId);
282283
}
283284

284285
// Step 2: Fetch snapshots WITHOUT waitpoints to avoid N×M data explosion

0 commit comments

Comments
 (0)