aboutsummaryrefslogtreecommitdiff
path: root/routers/api/v1/user_app.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-10-08 20:36:07 -0400
committerUnknwon <u@gogs.io>2015-10-08 20:36:07 -0400
commitaff49b1c9eaa33f7c530275f2695d6d96699ec5d (patch)
treec3720601db2e005e57032feb42deac7e347ac713 /routers/api/v1/user_app.go
parentb1941f1da18b8c6ca046771c21f21ba793765518 (diff)
unified API error response
Diffstat (limited to 'routers/api/v1/user_app.go')
-rw-r--r--routers/api/v1/user_app.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/routers/api/v1/user_app.go b/routers/api/v1/user_app.go
index 5e5156ac..590d187e 100644
--- a/routers/api/v1/user_app.go
+++ b/routers/api/v1/user_app.go
@@ -8,7 +8,6 @@ import (
api "github.com/gogits/go-gogs-client"
"github.com/gogits/gogs/models"
- "github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/middleware"
)
@@ -16,7 +15,7 @@ import (
func ListAccessTokens(ctx *middleware.Context) {
tokens, err := models.ListAccessTokens(ctx.User.Id)
if err != nil {
- ctx.JSON(500, &base.ApiJsonErr{"ListAccessTokens: " + err.Error(), base.DOC_URL})
+ ctx.APIError(500, "ListAccessTokens", err)
return
}
@@ -38,7 +37,7 @@ func CreateAccessToken(ctx *middleware.Context, form CreateAccessTokenForm) {
Name: form.Name,
}
if err := models.NewAccessToken(t); err != nil {
- ctx.JSON(500, &base.ApiJsonErr{"NewAccessToken: " + err.Error(), base.DOC_URL})
+ ctx.APIError(500, "NewAccessToken", err)
return
}
ctx.JSON(201, &api.AccessToken{t.Name, t.Sha1})