Cleanup api responses

This commit is contained in:
simon987
2019-02-16 19:44:03 -05:00
parent 8784b536d3
commit 71e05ecdd6
21 changed files with 809 additions and 888 deletions

View File

@@ -5,21 +5,17 @@ import (
"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{
r.Json(JsonResponse{
Message: err.Error(),
StackTrace: string(debug.Stack()),
Content: ErrorResponse{
StackTrace: string(debug.Stack()),
},
}, 500)
}
}