feat 添加SetErrorHandle方法

This commit is contained in:
timerzz 2024-08-31 16:49:48 +08:00
parent adcb9ed31b
commit 35b6608cc1

View File

@ -57,6 +57,11 @@ func (s *Server) Unsubscribe(channel string) error {
return s.pubSub.Unsubscribe(s.ctx, channel) return s.pubSub.Unsubscribe(s.ctx, channel)
} }
func (s *Server) SetErrorHandle(f func(err error)) *Server {
s.errHandle = f
return s
}
func (s *Server) Run() { func (s *Server) Run() {
ch := s.pubSub.Channel() ch := s.pubSub.Channel()
defer s.pubSub.Close() defer s.pubSub.Close()