File size: 523 Bytes
0c932f9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /**
* Custom error thrown when AI generation fails part-way through.
* Carries `tokensUsed` so the caller can record consumed tokens even on failure.
*/
export class GenerationError extends Error {
tokensUsed?: number;
partialResult?: { questions: unknown[] };
constructor(message: string, opts?: { tokensUsed?: number; partialResult?: { questions: unknown[] } }) {
super(message);
this.name = "GenerationError";
this.tokensUsed = opts?.tokensUsed;
this.partialResult = opts?.partialResult;
}
}
|