Skip to content

Commit 60a3297

Browse files
authored
Use ServerError provided by Context (#14333)
... instead of InternalServerError by macaron
1 parent f76c300 commit 60a3297

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

routers/admin/users.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ func prepareUserInfo(ctx *context.Context) *models.User {
188188
_, err = models.GetTwoFactorByUID(u.ID)
189189
if err != nil {
190190
if !models.IsErrTwoFactorNotEnrolled(err) {
191-
ctx.InternalServerError(err)
191+
ctx.ServerError("IsErrTwoFactorNotEnrolled", err)
192192
return nil
193193
}
194194
ctx.Data["TwoFactorEnabled"] = false
@@ -268,7 +268,7 @@ func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) {
268268
return
269269
}
270270
if err = u.SetPassword(form.Password); err != nil {
271-
ctx.InternalServerError(err)
271+
ctx.ServerError("SetPassword", err)
272272
return
273273
}
274274
}
@@ -285,12 +285,12 @@ func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) {
285285
if form.Reset2FA {
286286
tf, err := models.GetTwoFactorByUID(u.ID)
287287
if err != nil && !models.IsErrTwoFactorNotEnrolled(err) {
288-
ctx.InternalServerError(err)
288+
ctx.ServerError("GetTwoFactorByUID", err)
289289
return
290290
}
291291

292292
if err = models.DeleteTwoFactorByID(tf.ID, u.ID); err != nil {
293-
ctx.InternalServerError(err)
293+
ctx.ServerError("DeleteTwoFactorByID", err)
294294
return
295295
}
296296
}

routers/repo/issue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ func ViewIssue(ctx *context.Context) {
11171117
iw.IssueID = issue.ID
11181118
iw.IsWatching, err = models.CheckIssueWatch(ctx.User, issue)
11191119
if err != nil {
1120-
ctx.InternalServerError(err)
1120+
ctx.ServerError("CheckIssueWatch", err)
11211121
return
11221122
}
11231123
}

routers/repo/projects.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ func DeleteProjectBoard(ctx *context.Context) {
355355

356356
pb, err := models.GetProjectBoard(ctx.ParamsInt64(":boardID"))
357357
if err != nil {
358-
ctx.InternalServerError(err)
358+
ctx.ServerError("GetProjectBoard", err)
359359
return
360360
}
361361
if pb.ProjectID != ctx.ParamsInt64(":id") {
@@ -445,7 +445,7 @@ func EditProjectBoardTitle(ctx *context.Context, form auth.EditProjectBoardTitle
445445

446446
board, err := models.GetProjectBoard(ctx.ParamsInt64(":boardID"))
447447
if err != nil {
448-
ctx.InternalServerError(err)
448+
ctx.ServerError("GetProjectBoard", err)
449449
return
450450
}
451451
if board.ProjectID != ctx.ParamsInt64(":id") {

routers/repo/pull.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,11 +713,11 @@ func UpdatePullRequest(ctx *context.Context) {
713713
}
714714

715715
if err := issue.PullRequest.LoadBaseRepo(); err != nil {
716-
ctx.InternalServerError(err)
716+
ctx.ServerError("LoadBaseRepo", err)
717717
return
718718
}
719719
if err := issue.PullRequest.LoadHeadRepo(); err != nil {
720-
ctx.InternalServerError(err)
720+
ctx.ServerError("LoadHeadRepo", err)
721721
return
722722
}
723723

0 commit comments

Comments
 (0)