cpns / packages /ai /src /errors.ts
rogasper's picture
feat: add comprehensive AGENTS.md documentation and enhance UI components with new images and card layouts for sign-in and sign-up forms. Update routing to include landing and attempt routes, and improve sidebar functionality with state management.
0c932f9
Raw
History Blame Contribute Delete
523 Bytes
/**
* 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;
}
}