aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author65432020-05-07 21:42:33 +0200
committerGitHub2020-05-07 22:42:33 +0300
commit79868d7096296f2afa4ccdc20cc69efac693b812 (patch)
treeb62fe9dda18252863fa33d76719e49b17ac00683
parent19626b93f8d04fd72cf8fc3abb6c53666b44537b (diff)
When delete tracked time through the API return 404 not 500 (#11319) (#11326)
-rw-r--r--routers/api/v1/repo/issue_tracked_time.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/api/v1/repo/issue_tracked_time.go b/routers/api/v1/repo/issue_tracked_time.go
index 80830e2fe..ec49fdbfd 100644
--- a/routers/api/v1/repo/issue_tracked_time.go
+++ b/routers/api/v1/repo/issue_tracked_time.go
@@ -289,7 +289,11 @@ func DeleteTime(ctx *context.APIContext) {
time, err := models.GetTrackedTimeByID(ctx.ParamsInt64(":id"))
if err != nil {
- ctx.Error(500, "GetTrackedTimeByID", err)
+ if models.IsErrNotExist(err) {
+ ctx.NotFound(err)
+ return
+ }
+ ctx.Error(http.StatusInternalServerError, "GetTrackedTimeByID", err)
return
}