feat: don't always report update errors to frontend

This commit is contained in:
James Houlahan
2021-01-14 16:07:33 +01:00
parent 10301b8600
commit 9bb7c828cd
4 changed files with 43 additions and 6 deletions

View File

@ -31,6 +31,7 @@ import (
"github.com/ProtonMail/proton-bridge/internal/imap"
"github.com/ProtonMail/proton-bridge/internal/smtp"
"github.com/ProtonMail/proton-bridge/internal/updater"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
)
@ -165,8 +166,13 @@ func checkAndHandleUpdate(u types.Updater, f frontend.Frontend, autoUpdate bool)
}
if err := u.InstallUpdate(version); err != nil {
logrus.WithError(err).Error("An error occurred while silent installing updates")
f.NotifySilentUpdateError(err)
if errors.Cause(err) == updater.ErrDownloadVerify {
logrus.WithError(err).Warning("Skipping update installation due to temporary error")
} else {
logrus.WithError(err).Error("The update couldn't be installed")
f.NotifySilentUpdateError(err)
}
return
}