2022-05-02 09:35:49 +02:00

20 lines
315 B
Go

package photosapi
import (
"github.com/gin-gonic/gin"
)
func (s *Service) Error(c *gin.Context, code int, err error) {
var status string
if code >= 200 && code < 400 {
status = "success"
} else {
status = "failed"
}
c.AbortWithStatusJSON(code, gin.H{
"status": status,
"error": err.Error(),
})
}