| 585 | * @since 4.0.0 |
| 586 | */ |
| 587 | export class InvalidRequestError extends Schema.Error<InvalidRequestError>( |
| 588 | "effect/ai/AiError/InvalidRequestError" |
| 589 | )({ |
| 590 | _tag: Schema.tag("InvalidRequestError"), |
| 591 | parameter: Schema.optional(Schema.String), |
| 592 | constraint: Schema.optional(Schema.String), |
| 593 | description: Schema.optional(Schema.String), |
| 594 | metadata: providerMetadataWithDefaults<InvalidRequestErrorMetadata>(), |
| 595 | http: Schema.optional(HttpContext) |
| 596 | }) { |
| 597 | /** |
| 598 | * Marks `InvalidRequestError` as a semantic AI error reason for runtime guards. |
| 599 | * |
| 600 | * @since 4.0.0 |
| 601 | */ |
| 602 | readonly [ReasonTypeId] = ReasonTypeId |
| 603 | |
| 604 | /** |
| 605 | * Invalid request errors require fixing the request and are not retryable. |
| 606 | * |
| 607 | * @since 4.0.0 |
| 608 | */ |
| 609 | get isRetryable(): boolean { |
| 610 | return false |
| 611 | } |
| 612 | |
| 613 | override get message(): string { |
| 614 | let msg = "Invalid request" |
| 615 | if (this.parameter) msg += `: parameter '${this.parameter}'` |
| 616 | if (this.constraint) msg += ` ${this.constraint}` |
| 617 | if (this.description) msg += `. ${this.description}` |
| 618 | return msg |
| 619 | } |
| 620 | } |
| 621 | |
| 622 | /** |
| 623 | * Error indicating the AI provider experienced an internal error. |
nothing calls this directly
no test coverage detected