From 35b6608cc12383bda6394be478f6478a07496871 Mon Sep 17 00:00:00 2001 From: timerzz Date: Sat, 31 Aug 2024 16:49:48 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E6=B7=BB=E5=8A=A0SetErrorHandle?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/subscribe/server.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/subscribe/server.go b/pkg/subscribe/server.go index 0983918..688f8f3 100644 --- a/pkg/subscribe/server.go +++ b/pkg/subscribe/server.go @@ -57,6 +57,11 @@ func (s *Server) Unsubscribe(channel string) error { 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() { ch := s.pubSub.Channel() defer s.pubSub.Close()