File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 44package admin
55
66import (
7+ "errors"
78 "net/http"
89
910 "code.gitea.io/gitea/models/webhook"
@@ -74,7 +75,11 @@ func GetHook(ctx *context.APIContext) {
7475 hookID := ctx .ParamsInt64 (":id" )
7576 hook , err := webhook .GetSystemOrDefaultWebhook (ctx , hookID )
7677 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+ }
7883 return
7984 }
8085 h , err := webhook_service .ToHook ("/admin/" , hook )
@@ -163,7 +168,7 @@ func DeleteHook(ctx *context.APIContext) {
163168
164169 hookID := ctx .ParamsInt64 (":id" )
165170 if err := webhook .DeleteDefaultSystemWebhook (ctx , hookID ); err != nil {
166- if webhook . IsErrWebhookNotExist (err ) {
171+ if errors . Is (err , util . ErrNotExist ) {
167172 ctx .NotFound ()
168173 } else {
169174 ctx .Error (http .StatusInternalServerError , "DeleteDefaultSystemWebhook" , err )
You can’t perform that action at this time.
0 commit comments