From 3cafd59cf74440b02fe21fe44be216a51b03cd13 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Mon, 16 May 2022 11:43:09 +0300 Subject: [PATCH] Handle key missing errors when syncing app state --- commands.go | 5 ++++- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/commands.go b/commands.go index b287c23..ca91e6d 100644 --- a/commands.go +++ b/commands.go @@ -1135,7 +1135,10 @@ func (handler *CommandHandler) CommandSync(ce *CommandEvent) { if appState { for _, name := range appstate.AllPatchNames { err := ce.User.Client.FetchAppState(name, true, false) - if err != nil { + if errors.Is(err, appstate.ErrKeyNotFound) { + ce.Reply("Key not found error syncing app state %s: %v\n\nKey requests are sent automatically, and the sync should happen in the background after your phone responds.", name, err) + return + } else if err != nil { ce.Reply("Error syncing app state %s: %v", name, err) } else if name == appstate.WAPatchCriticalUnblockLow { ce.Reply("Synced app state %s, contact sync running in background", name) diff --git a/go.mod b/go.mod index 7f3a7e7..01e025b 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/prometheus/client_golang v1.12.2-0.20220514081015-5d584e2717ef github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e github.com/tidwall/gjson v1.14.1 - go.mau.fi/whatsmeow v0.0.0-20220516080154-a168fde5a9de + go.mau.fi/whatsmeow v0.0.0-20220516084153-89886dde861b golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 golang.org/x/net v0.0.0-20220513224357-95641704303c google.golang.org/protobuf v1.28.0 diff --git a/go.sum b/go.sum index 6651b20..12f9a85 100644 --- a/go.sum +++ b/go.sum @@ -62,8 +62,8 @@ github.com/yuin/goldmark v1.4.12 h1:6hffw6vALvEDqJ19dOJvJKOoAOKe4NDaTqvd2sktGN0= github.com/yuin/goldmark v1.4.12/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.mau.fi/libsignal v0.0.0-20220425070825-c40c839ee6a0 h1:3IQF2bgAyibdo77hTejwuJe4jlypj9QaE4xCQuxrThM= go.mau.fi/libsignal v0.0.0-20220425070825-c40c839ee6a0/go.mod h1:kBOXTvYyDG/q1Ihgvd4J6WenGPh7wtEGvPKF6vmf5ak= -go.mau.fi/whatsmeow v0.0.0-20220516080154-a168fde5a9de h1:656AnW7jfFOU42e3py0beh5rj5/Ikg7sxmyQBLiSJGA= -go.mau.fi/whatsmeow v0.0.0-20220516080154-a168fde5a9de/go.mod h1:iUBgOLNaqShLrR17u0kIiRptIGFH+nbT1tRhaWBEX/c= +go.mau.fi/whatsmeow v0.0.0-20220516084153-89886dde861b h1:ivuB8z2Ai8wJ1aibXWh1Fr1ETmvLIt3JlAoaNXSa6vg= +go.mau.fi/whatsmeow v0.0.0-20220516084153-89886dde861b/go.mod h1:iUBgOLNaqShLrR17u0kIiRptIGFH+nbT1tRhaWBEX/c= golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9 h1:NUzdAbFtCJSXU20AOXgeqaUwg8Ypg4MPYmL+d+rsB5c= golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=