diff options
author | Unknwon <u@gogs.io> | 2015-10-08 20:36:07 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-10-08 20:36:07 -0400 |
commit | aff49b1c9eaa33f7c530275f2695d6d96699ec5d (patch) | |
tree | c3720601db2e005e57032feb42deac7e347ac713 /routers/api/v1/miscellaneous.go | |
parent | b1941f1da18b8c6ca046771c21f21ba793765518 (diff) |
unified API error response
Diffstat (limited to 'routers/api/v1/miscellaneous.go')
-rw-r--r-- | routers/api/v1/miscellaneous.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/api/v1/miscellaneous.go b/routers/api/v1/miscellaneous.go index 0da5dc15..7ffce857 100644 --- a/routers/api/v1/miscellaneous.go +++ b/routers/api/v1/miscellaneous.go @@ -16,7 +16,7 @@ import ( // Render an arbitrary Markdown document. func Markdown(ctx *middleware.Context, form apiv1.MarkdownForm) { if ctx.HasApiError() { - ctx.JSON(422, base.ApiJsonErr{ctx.GetErrMsg(), base.DOC_URL}) + ctx.APIError(422, "", ctx.GetErrMsg()) return } @@ -38,7 +38,7 @@ func Markdown(ctx *middleware.Context, form apiv1.MarkdownForm) { func MarkdownRaw(ctx *middleware.Context) { body, err := ctx.Req.Body().Bytes() if err != nil { - ctx.JSON(422, base.ApiJsonErr{err.Error(), base.DOC_URL}) + ctx.APIError(422, "", err) return } ctx.Write(base.RenderRawMarkdown(body, "")) |