errors.ts28 lines · main
| 1 | export class ApplicationError extends Error { |
| 2 | constructor( |
| 3 | message: string, |
| 4 | public data: Record<string, any> = {} |
| 5 | ) { |
| 6 | super(message) |
| 7 | } |
| 8 | } |
| 9 | |
| 10 | export class ContextLengthError extends ApplicationError { |
| 11 | constructor() { |
| 12 | super('LLM context length exceeded') |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | export class EmptyResponseError extends ApplicationError { |
| 17 | constructor() { |
| 18 | super('LLM API response succeeded but returned nothing') |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | export class EmptySqlError extends ApplicationError { |
| 23 | constructor() { |
| 24 | super('LLM did not generate any SQL') |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | export class UserError extends ApplicationError {} |