@@ -5,12 +5,12 @@ package user
55
66import (
77 "net/http"
8- "strconv"
98
109 admin_model "code.gitea.io/gitea/models/admin"
1110 access_model "code.gitea.io/gitea/models/perm/access"
1211 "code.gitea.io/gitea/models/unit"
1312 "code.gitea.io/gitea/modules/json"
13+ "code.gitea.io/gitea/modules/log"
1414 "code.gitea.io/gitea/services/context"
1515)
1616
@@ -20,33 +20,36 @@ func TaskStatus(ctx *context.Context) {
2020 if err != nil {
2121 if admin_model .IsErrTaskDoesNotExist (err ) {
2222 ctx .JSON (http .StatusNotFound , map [string ]any {
23- "error " : "task `" + strconv . FormatInt ( ctx . PathParamInt64 ( "task" ), 10 ) + "` does not exist " ,
23+ "err " : "task does not exist or you do not have access to this task " ,
2424 })
2525 return
2626 }
27+ log .Error ("GetMigratingTaskByID: %v" , err )
2728 ctx .JSON (http .StatusInternalServerError , map [string ]any {
28- "err" : err ,
29+ "err" : http . StatusText ( http . StatusInternalServerError ) ,
2930 })
3031 return
3132 }
3233
3334 if err := task .LoadRepo (ctx ); err != nil {
35+ log .Error ("LoadRepo: %v" , err )
3436 ctx .JSON (http .StatusInternalServerError , map [string ]any {
35- "err" : err ,
37+ "err" : http . StatusText ( http . StatusInternalServerError ) ,
3638 })
3739 return
3840 }
3941
4042 perm , err := access_model .GetUserRepoPermission (ctx , task .Repo , ctx .Doer )
4143 if err != nil {
44+ log .Error ("LoadRepo: %v" , err )
4245 ctx .JSON (http .StatusInternalServerError , map [string ]any {
43- "err" : err ,
46+ "err" : http . StatusText ( http . StatusInternalServerError ) ,
4447 })
4548 return
4649 }
4750 if ! perm .CanRead (unit .TypeCode ) {
48- ctx .JSON (http .StatusForbidden , map [string ]any {
49- "error " : "you do not have access to this task" ,
51+ ctx .JSON (http .StatusNotFound , map [string ]any {
52+ "err " : "task does not exist or you do not have access to this task" ,
5053 })
5154 return
5255 }
0 commit comments