Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR standardizes HTTP error response types across the API by introducing a shared handlers.Error model and wiring it into both handlers and Swagger documentation.
Changes:
- Introduced a centralized
handlers.Errorstruct and updated user, session, and health handlers to return this type instead of ad-hocgin.H{"error": ...}maps. - Updated Swagger annotations in handlers plus
swagger.yaml,swagger.json, anddocs.goto reference the newhandlers.Errordefinition for 4xx/5xx responses. - Ensured error response schemas are aligned between runtime behavior and API documentation for all relevant user and session endpoints.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
internal/handlers/userhandler/post.go |
Switches POST /auth/user error responses to use handlers.Error and updates Swagger failure types accordingly. |
internal/handlers/userhandler/patch.go |
Updates PATCH /auth/user bad request and internal error responses to use handlers.Error and aligns annotations. |
internal/handlers/userhandler/get.go |
Uses handlers.Error for not-found and internal errors on GET /auth/user and updates Swagger failure schemas. |
internal/handlers/userhandler/delete.go |
Standardizes DELETE /auth/user internal error response on handlers.Error and adjusts failure annotation. |
internal/handlers/sessionhandler/post.go |
Updates login error paths (400/401/500) to return handlers.Error and documents these in Swagger. |
internal/handlers/sessionhandler/delete.go |
Standardizes logout error responses (400/401/500) on handlers.Error and updates Swagger annotations. |
internal/handlers/health/get.go |
Returns handlers.Error for database unavailability on the health check endpoint. |
internal/handlers/error.go |
Introduces the shared handlers.Error struct ({"error": string}) used by all handlers. |
docs/swagger.yaml |
Defines handlers.Error in the OpenAPI spec and rewires relevant response schemas to reference it. |
docs/swagger.json |
Mirrors the YAML changes in the generated JSON Swagger spec, referencing handlers.Error for error responses. |
docs/docs.go |
Updates the embedded Swagger template to define and use handlers.Error for documented error responses. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Ferrari78
approved these changes
Jan 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.