From b13062316afbfed6c767f8ad3ac2b5bc348bdc9f Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Mon, 1 Aug 2022 15:13:23 -0400 Subject: [PATCH] fix: call recoverer for go listeners --- golibs/bait/bait.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/golibs/bait/bait.go b/golibs/bait/bait.go index 1e7ff89..50c49ab 100644 --- a/golibs/bait/bait.go +++ b/golibs/bait/bait.go @@ -41,6 +41,12 @@ func (b *Bait) Emit(event string, args ...interface{}) { if handles != nil { for _, handle := range handles { + defer func() { + if err := recover(); err != nil { + b.callRecoverer(event, handle, err) + } + }() + handle(args...) } }