Skip to content

Evaluation: Structured errors for limits #682

@vprashrex

Description

@vprashrex

Is your feature request related to a problem?
When using the evaluations API with an invalid limit value (e.g., -1), it returns a raw PostgreSQL database error instead of a structured validation error. This exposes internal SQL details and disrupts standard API error handling.

Describe the solution you'd like

  • Return a structured validation error instead of a raw SQL error for invalid limit values.
  • Ensure error response format matches the expected behavior outlined above.
Original issue

Describe the bug
When calling the evaluations API with an invalid limit value (e.g., -1), the API returns a raw database error from PostgreSQL instead of a structured validation error.
This exposes internal SQL details and breaks expected API error handling standards.

To Reproduce
Steps to reproduce the behavior:
Send a GET request to:
/api/v1/evaluations?limit=-1&offset=0
Observe the response

Expected behavior

{
    "success": false,
    "data": null,
    "error": "Validation failed",
    "errors": [
        {
            "field": "query.limit",
            "message": "Input should be greater than 0"
        }
    ],
    "metadata": null
}

Screenshots

Image

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions