open-agreements
Version:
Open-source legal template filling CLI and library
29 lines • 1.01 kB
JavaScript
/**
* Typed errors for the generation compiler.
*
* GenerationSpecError reports problems in the caller's DocumentSpec (dangling
* references, unimplemented features, shape violations) with a JSON-pointer-ish
* path into the spec so callers can surface the exact offending node.
*
* GenerationInternalError flags compiler bugs (e.g. an emitter producing a
* property name missing from its ordering table); it should never be reachable
* from user input that passed spec validation.
*/
export class GenerationSpecError extends Error {
code;
/** Path into the spec, e.g. '/sections/0/blocks/2/runs/1'. */
path;
constructor(code, path, message) {
super(`${message} (at ${path})`);
this.name = 'GenerationSpecError';
this.code = code;
this.path = path;
}
}
export class GenerationInternalError extends Error {
constructor(message) {
super(message);
this.name = 'GenerationInternalError';
}
}
//# sourceMappingURL=errors.js.map