From ec7051e1da665206f594c7616ad381bfeaea333a Mon Sep 17 00:00:00 2001 From: Sebastien Douheret Date: Thu, 11 May 2017 19:42:00 +0200 Subject: Initial main commit. Signed-off-by: Sebastien Douheret --- lib/common/error.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 lib/common/error.go (limited to 'lib/common/error.go') diff --git a/lib/common/error.go b/lib/common/error.go new file mode 100644 index 0000000..d03c176 --- /dev/null +++ b/lib/common/error.go @@ -0,0 +1,13 @@ +package common + +import ( + "github.com/gin-gonic/gin" +) + +// APIError returns an uniform json formatted error +func APIError(c *gin.Context, err string) { + c.JSON(500, gin.H{ + "status": "error", + "error": err, + }) +} -- cgit 1.2.3-korg