Skip to content

Validate error standardization fix in ChatCompletion handler#9

Closed
Copilot wants to merge 1 commit into
refactoring/basic-structurefrom
copilot/sub-pr-6-another-one
Closed

Validate error standardization fix in ChatCompletion handler#9
Copilot wants to merge 1 commit into
refactoring/basic-structurefrom
copilot/sub-pr-6-another-one

Conversation

Copilot AI commented Dec 7, 2025

Copy link
Copy Markdown
Contributor

Validated that the inline error construction in ChatCompletion handler has been replaced with standardized error handling using core.NewInvalidRequestError() and handleError().

Changes validated:

  • Bind errors now use core.NewInvalidRequestError() instead of hardcoded error type and manual JSON construction
  • Unsupported model errors follow the same pattern
  • Both error cases delegate to handleError() helper for consistent response formatting

Before (commit cb82c33):

if err := c.Bind(&req); err != nil {
    return c.JSON(http.StatusBadRequest, map[string]interface{}{
        "error": map[string]interface{}{
            "type":    "invalid_request_error",
            "message": "invalid request body: " + err.Error(),
        },
    })
}

After (commit b8dd547):

if err := c.Bind(&req); err != nil {
    return handleError(c, core.NewInvalidRequestError("invalid request body: "+err.Error(), err))
}

All handler tests pass. Error responses maintain consistent JSON structure via GatewayError.ToJSON().


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Update error standardization based on PR feedback Validate error standardization fix in ChatCompletion handler Dec 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants