Initial commit

This commit is contained in:
simon987
2019-01-12 16:18:14 -05:00
commit 83276ce8b0
25 changed files with 1367 additions and 0 deletions

25
api/error.go Normal file
View File

@@ -0,0 +1,25 @@
package api
import (
"github.com/Sirupsen/logrus"
"runtime/debug"
)
type ErrorResponse struct {
Message string `json:"message"`
StackTrace string `json:"stack_trace"`
}
func handleErr(err error, r *Request) {
if err != nil {
logrus.Error(err.Error())
//debug.PrintStack()
r.Json(ErrorResponse{
Message: err.Error(),
StackTrace: string(debug.Stack()),
}, 500)
}
}