-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy patherrors.ts
More file actions
53 lines (44 loc) · 1.47 KB
/
errors.ts
File metadata and controls
53 lines (44 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* eslint-disable max-classes-per-file */
export class WorkflowExecutorError extends Error {
constructor(message: string) {
super(message);
this.name = this.constructor.name;
}
}
export class MissingToolCallError extends WorkflowExecutorError {
constructor() {
super('AI did not return a tool call');
}
}
export class MalformedToolCallError extends WorkflowExecutorError {
readonly toolName: string;
constructor(toolName: string, details: string) {
super(`AI returned a malformed tool call for "${toolName}": ${details}`);
this.toolName = toolName;
}
}
export class RecordNotFoundError extends WorkflowExecutorError {
constructor(collectionName: string, recordId: string) {
super(`Record not found: collection "${collectionName}", id "${recordId}"`);
}
}
export class NoRecordsError extends WorkflowExecutorError {
constructor() {
super('No records available');
}
}
export class NoReadableFieldsError extends WorkflowExecutorError {
constructor(collectionName: string) {
super(`No readable fields on record from collection "${collectionName}"`);
}
}
export class NoResolvedFieldsError extends WorkflowExecutorError {
constructor(fieldNames: string[]) {
super(`None of the requested fields could be resolved: ${fieldNames.join(', ')}`);
}
}
export class NoWritableFieldsError extends WorkflowExecutorError {
constructor(collectionName: string) {
super(`No writable fields on record from collection "${collectionName}"`);
}
}