The best way to control Claude Code, Codex and more from any computer or phone

main
ts 34 lines 1.19 KB
Raw
1 import * as Data from "effect/Data";
2 import { UserFacingError } from "../UserFacingError.ts";
3
4 /** A non-fatal note attached to a successful result. */
5 export interface Diagnostic {
6 readonly severity: "debug" | "info" | "warning" | "error";
7 readonly code: string;
8 readonly message: string;
9 }
10
11 // Tag names are prefixed because the bare ones are already taken by the
12 // clouds we talk to — distilled's core ships `NotFound`, Route53 ships
13 // `InvalidInput` — and these errors travel in unions with cloud errors,
14 // where `catchTag` discriminates by tag alone.
15
16 /** The caller sent something the operation cannot act on. */
17 export class AlchemistInvalidInput extends Data.TaggedError("AlchemistInvalidInput")<{
18 readonly message: string;
19 readonly field?: string;
20 }> {
21 readonly [UserFacingError] = true;
22 }
23
24 /** A named entity (profile, provider) does not resolve. */
25 export class AlchemistNotFound extends Data.TaggedError("AlchemistNotFound")<{
26 readonly kind: string;
27 readonly id: string;
28 }> {
29 readonly [UserFacingError] = true;
30 /** Human-readable line derived from the missing entity's kind and id. */
31 override get message(): string {
32 return `No ${this.kind} named '${this.id}'.`;
33 }
34 }