Skip to content

Commit

Permalink
webhooks: panic if webhook is not properly unregistered
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Dec 8, 2023
1 parent 9fa8a0f commit 9c94d30
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion webhooks/webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ func (m *Manager) findMatchingHooks(s string) (hooks []WebHook) {
var match func(scopeParts []string, parent *scope)
match = func(scopeParts []string, parent *scope) {
for id := range parent.hooks {
hooks = append(hooks, m.hooks[id])
hook, ok := m.hooks[id]
if !ok {
panic("hook not found") // developer error
}
hooks = append(hooks, hook)
}
if len(scopeParts) == 0 {
return
Expand Down
1 change: 0 additions & 1 deletion webhooks/webhooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,4 @@ func TestWebHooks(t *testing.T) {
t.Fatal("expected no event")
}
}

}

0 comments on commit 9c94d30

Please sign in to comment.