File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 4
4
package admin
5
5
6
6
import (
7
+ "errors"
7
8
"net/http"
8
9
9
10
"code.gitea.io/gitea/models/webhook"
@@ -74,7 +75,11 @@ func GetHook(ctx *context.APIContext) {
74
75
hookID := ctx .ParamsInt64 (":id" )
75
76
hook , err := webhook .GetSystemOrDefaultWebhook (ctx , hookID )
76
77
if err != nil {
77
- ctx .Error (http .StatusInternalServerError , "GetSystemOrDefaultWebhook" , err )
78
+ if errors .Is (err , util .ErrNotExist ) {
79
+ ctx .NotFound ()
80
+ } else {
81
+ ctx .Error (http .StatusInternalServerError , "GetSystemOrDefaultWebhook" , err )
82
+ }
78
83
return
79
84
}
80
85
h , err := webhook_service .ToHook ("/admin/" , hook )
@@ -163,7 +168,7 @@ func DeleteHook(ctx *context.APIContext) {
163
168
164
169
hookID := ctx .ParamsInt64 (":id" )
165
170
if err := webhook .DeleteDefaultSystemWebhook (ctx , hookID ); err != nil {
166
- if webhook . IsErrWebhookNotExist (err ) {
171
+ if errors . Is (err , util . ErrNotExist ) {
167
172
ctx .NotFound ()
168
173
} else {
169
174
ctx .Error (http .StatusInternalServerError , "DeleteDefaultSystemWebhook" , err )
You can’t perform that action at this time.
0 commit comments