From 1a6fdf565e600368f4d541e556da4b0d8e2c7196 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 7 Feb 2021 16:54:09 +0200 Subject: [PATCH] Fix error checks in provisioning API login --- provisioning.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/provisioning.go b/provisioning.go index 4aa2481..7bd8826 100644 --- a/provisioning.go +++ b/provisioning.go @@ -362,13 +362,13 @@ func (prov *ProvisioningAPI) Login(w http.ResponseWriter, r *http.Request) { qrChan <- "stop" if err != nil { var msg string - if err == whatsapp.ErrAlreadyLoggedIn { + if errors.Is(err, whatsapp.ErrAlreadyLoggedIn) { msg = "You're already logged in" - } else if err == whatsapp.ErrLoginInProgress { + } else if errors.Is(err, whatsapp.ErrLoginInProgress) { msg = "You have a login in progress already." - } else if err == whatsapp.ErrLoginTimedOut { + } else if errors.Is(err, whatsapp.ErrLoginTimedOut) { msg = "QR code scan timed out. Please try again." - } else if err == whatsapp.ErrInvalidWebsocket { + } else if errors.Is(err, whatsapp.ErrInvalidWebsocket) { msg = "WhatsApp connection error. Please try again." user.Disconnect() } else {