forked from mcvardo/PackPath
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.js
More file actions
49 lines (45 loc) · 1.35 KB
/
errors.js
File metadata and controls
49 lines (45 loc) · 1.35 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
// errors.js
// Typed error classes for PackPath pipeline failures.
// Use these instead of generic Error so callers can distinguish failure modes.
/**
* Thrown when a region config file is missing, malformed, or fails validation.
*/
export class RegionConfigError extends Error {
constructor(message) {
super(message);
this.name = 'RegionConfigError';
}
}
/**
* Thrown when graph construction fails — e.g. the seed trail is not found
* in the OSM data, or the main connected component cannot be seeded.
*/
export class GraphBuildError extends Error {
constructor(message) {
super(message);
this.name = 'GraphBuildError';
}
}
/**
* Thrown when the LLM call fails, returns unparseable JSON, or when
* post-processing cannot match an archetype to its input cluster.
* The grounding guarantee is broken if this is swallowed.
*/
export class NarrationError extends Error {
constructor(message) {
super(message);
this.name = 'NarrationError';
}
}
/**
* Thrown when narration validation fails after all retries are exhausted
* and the caller has opted to treat that as a hard failure.
* @property {Array<{route: string, check: string, msg: string}>} errors
*/
export class ValidationError extends Error {
constructor(message, errors = []) {
super(message);
this.name = 'ValidationError';
this.errors = errors;
}
}