package api import ( "github.com/gin-gonic/gin" ) // ErrorResponse is the standard JSON body for HTTP API errors. type ErrorResponse struct { Error ErrorBody `json:"error"` } // ErrorBody contains human-readable error details. type ErrorBody struct { Message string `json:"message"` } // Error writes a JSON error response. func Error(c *gin.Context, status int, message string) { c.JSON(status, ErrorResponse{ Error: ErrorBody{ Message: message, }, }) }