summaryrefslogtreecommitdiffstats
path: root/lib/common/error.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-05-22 13:51:04 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-05-22 13:51:04 +0200
commitad8f8d97a48f155ba94d5646012e969845a315ab (patch)
treeb991f09b8d08c900dd08583522a7db952ed43c79 /lib/common/error.go
parentfbbcd6cedc47e45f6a2aaae708be194731a0139b (diff)
Allow to set Syncthing rescanInterval parameter.
Diffstat (limited to 'lib/common/error.go')
-rw-r--r--lib/common/error.go7
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,
})
}