Files
MusicServer/pkg/helpers/error.go
Sebastian f9d6c24a97 Changed routing framework from mux to Gin.
Swagger doc is now included in the application.
A fronted can now be hosted from the application.
2022-01-29 17:52:33 +01:00

17 lines
330 B
Go

package helpers
import "github.com/gin-gonic/gin"
func NewError(ctx *gin.Context, status int, err error) {
er := HTTPError{
Code: status,
Message: err.Error(),
}
ctx.JSON(status, er)
}
type HTTPError struct {
Code int `json:"code" example:"400"`
Message string `json:"message" example:"status bad request"`
}