diff options
Diffstat (limited to 'lib/common')
-rw-r--r-- | lib/common/error.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/common/error.go b/lib/common/error.go index d03c176..6873d82 100644 --- a/lib/common/error.go +++ b/lib/common/error.go @@ -1,13 +1,16 @@ package common import ( + "fmt" + "github.com/gin-gonic/gin" ) // APIError returns an uniform json formatted error -func APIError(c *gin.Context, err string) { +func APIError(c *gin.Context, format string, args ...interface{}) { + errMsg := fmt.Sprintf(format, args...) c.JSON(500, gin.H{ "status": "error", - "error": err, + "error": errMsg, }) } |