Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

Errors.ts

57 lines1.9 KB

1import * as Schema from "effect/Schema";
2​
3/**
4 * ProviderInstanceNotFoundError - Lookup against the instance registry failed.
5 *
6 * The driver may be registered, but no instance with the requested id has
7 * been bootstrapped — typically because
8 * the persisted instance id refers to an instance the user removed from
9 * settings, or because routing is asked for an instance before the registry
10 * has finished its first reload.
11 */
12export class ProviderInstanceNotFoundError extends Schema.TaggedError<ProviderInstanceNotFoundError>()(
13 "ProviderInstanceNotFoundError",
14 {
15 instanceId: Schema.String,
16 cause: Schema.optional(Schema.Defect()),
17 },
18) {
19 override get message(): string {
20 return `No provider instance bound to id '${this.instanceId}'`;
21 }
23​
24/**
25 * ProviderDriverError - A driver `create` call failed before producing an
26 * instance. Surfaced to the registry, which marks the offending entry as
27 * an "unavailable" shadow snapshot rather than crashing the server.
28 */
29export class ProviderDriverError extends Schema.TaggedError<ProviderDriverError>()(
30 "ProviderDriverError",
31 {
32 driver: Schema.String,
33 instanceId: Schema.String,
34 detail: Schema.String,
35 cause: Schema.optional(Schema.Defect()),
36 },
37) {
38 override get message(): string {
39 return `Provider driver '${this.driver}' failed to create instance '${this.instanceId}': ${this.detail}`;
40 }
42​
43/**
44 * ProviderWorkspaceMissingError - The session's working directory no longer
45 * exists on disk, so no provider process can start in it.
46 */
47export class ProviderWorkspaceMissingError extends Schema.TaggedError<ProviderWorkspaceMissingError>()(
48 "ProviderWorkspaceMissingError",
49 {
50 threadId: Schema.String,
51 cwd: Schema.String,
52 },
53) {
54 override get message(): string {
55 return `This thread's workspace folder no longer exists or is not a directory: ${this.cwd}. Restore the folder at this path before retrying.`;
56 }