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 }
22}
23
24export { ProviderDriverError } from "@t3tools/provider-core/server/errors";
25
26/**
27 * ProviderWorkspaceMissingError - The session's working directory no longer
28 * exists on disk, so no provider process can start in it.
29 */
30export class ProviderWorkspaceMissingError extends Schema.TaggedError<ProviderWorkspaceMissingError>()(
31 "ProviderWorkspaceMissingError",
32 {
33 threadId: Schema.String,
34 cwd: Schema.String,
35 },
36) {
37 override get message(): string {
38 return `This thread's workspace folder no longer exists or is not a directory: ${this.cwd}. Restore the folder at this path before retrying.`;
39 }
40}