From 6a526dbbe4e0d40716136263666639d1a7fd31df Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Wed, 1 Dec 2021 17:29:57 -0400 Subject: [PATCH] fix: dont panic when error in bait hook occurs --- golibs/bait/bait.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/golibs/bait/bait.go b/golibs/bait/bait.go index 929a26d..0ff9444 100644 --- a/golibs/bait/bait.go +++ b/golibs/bait/bait.go @@ -1,6 +1,7 @@ package bait import ( + "fmt" "hilbish/util" "github.com/chuckpreslar/emission" @@ -13,8 +14,12 @@ type Bait struct{ } func New() Bait { + emitter := emission.NewEmitter() + emitter.RecoverWith(func(_, _ interface{}, err error) { + fmt.Println(err) + }) return Bait{ - Em: emission.NewEmitter(), + Em: emitter, } }