]> source.dussan.org Git - gitea.git/commitdiff
When delete tracked time through the API return 404 not 500 (#11319) (#11326)
author6543 <6543@obermui.de>
Thu, 7 May 2020 19:42:33 +0000 (21:42 +0200)
committerGitHub <noreply@github.com>
Thu, 7 May 2020 19:42:33 +0000 (22:42 +0300)
routers/api/v1/repo/issue_tracked_time.go

index 80830e2fe6f71d9054241607115502f2241da504..ec49fdbfdfbccea766fbc4643a49a0267e513379 100644 (file)
@@ -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
        }