fix: remove handler when error in hook occurs

dev
TorchedSammy 2021-12-01 17:35:12 -04:00
parent 6a526dbbe4
commit 4a517bde5e
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 2 additions and 1 deletions

View File

@ -15,7 +15,8 @@ type Bait struct{
func New() Bait {
emitter := emission.NewEmitter()
emitter.RecoverWith(func(_, _ interface{}, err error) {
emitter.RecoverWith(func(hookname, hookfunc interface{}, err error) {
emitter.Off(hookname, hookfunc)
fmt.Println(err)
})
return Bait{