mirror of https://github.com/Hilbis/Hilbish
fix: dont panic when error in bait hook occurs
parent
3568b62219
commit
6a526dbbe4
|
@ -1,6 +1,7 @@
|
||||||
package bait
|
package bait
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"hilbish/util"
|
"hilbish/util"
|
||||||
|
|
||||||
"github.com/chuckpreslar/emission"
|
"github.com/chuckpreslar/emission"
|
||||||
|
@ -13,8 +14,12 @@ type Bait struct{
|
||||||
}
|
}
|
||||||
|
|
||||||
func New() Bait {
|
func New() Bait {
|
||||||
|
emitter := emission.NewEmitter()
|
||||||
|
emitter.RecoverWith(func(_, _ interface{}, err error) {
|
||||||
|
fmt.Println(err)
|
||||||
|
})
|
||||||
return Bait{
|
return Bait{
|
||||||
Em: emission.NewEmitter(),
|
Em: emitter,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue