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(), }) }