From db2eacb64d7d49197fa015dc4c7d659d0789dc8b Mon Sep 17 00:00:00 2001 From: Vassili Tchersky <32412779+vassilit@users.noreply.github.com> Date: Sat, 31 Dec 2022 13:43:21 +0100 Subject: [PATCH] Fix Updater.Stop() panic (#69) Updater.Stop() causes a call to http.Server.Shutdown() that make the listeners to immediately return ErrServerClosed, causing a panic when shutting down normally. On the contrary, we don't want to panic on ErrServerClosed. --- ext/updater.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/updater.go b/ext/updater.go index 181d0817..9da955d0 100644 --- a/ext/updater.go +++ b/ext/updater.go @@ -255,7 +255,7 @@ func (u *Updater) StartWebhook(b *gotgbot.Bot, opts WebhookOpts) error { } else { err = u.server.ListenAndServe() } - if err != nil && errors.Is(err, http.ErrServerClosed) { + if err != nil && !errors.Is(err, http.ErrServerClosed) { panic("http server failed: " + err.Error()) } }()