summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-09-01 10:36:22 +1000
committerJesse Duffield <jessedduffield@gmail.com>2018-09-01 10:36:55 +1000
commit42500817e00eac293a3e2c4e9e818022d02c2b81 (patch)
treed4de34adc51368f2fdd43ff4a8d8fa141297918c /pkg
parentd8aba3aeee2f7811c383305a5beb7253a748f02f (diff)
better error for nonbackwards compatible changes
Diffstat (limited to 'pkg')
-rw-r--r--pkg/i18n/english.go2
-rw-r--r--pkg/updates/updates.go16
2 files changed, 13 insertions, 5 deletions
diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go
index f6e865b7b..1d9e8b41e 100644
--- a/pkg/i18n/english.go
+++ b/pkg/i18n/english.go
@@ -329,7 +329,7 @@ func addEnglish(i18nObject *i18n.Bundle) error {
Other: "You already have the latest version",
}, &i18n.Message{
ID: "MajorVersionErr",
- Other: "New version has non-backwards compatible changes.",
+ Other: "New version ({{.newVersion}}) has non-backwards compatible changes compared to the current version ({{.currentVersion}})",
}, &i18n.Message{
ID: "CouldNotFindBinaryErr",
Other: "Could not find any binary at {{.url}}",
diff --git a/pkg/updates/updates.go b/pkg/updates/updates.go
index 5f533e5a0..4ec374616 100644
--- a/pkg/updates/updates.go
+++ b/pkg/updates/updates.go
@@ -96,6 +96,7 @@ func (u *Updater) majorVersionDiffers(oldVersion, newVersion string) bool {
func (u *Updater) checkForNewUpdate() (string, error) {
u.Log.Info("Checking for an updated version")
+ currentVersion := u.Config.GetVersion()
if err := u.RecordLastUpdateCheck(); err != nil {
return "", err
}
@@ -104,15 +105,22 @@ func (u *Updater) checkForNewUpdate() (string, error) {
if err != nil {
return "", err
}
- u.Log.Info("Current version is " + u.Config.GetVersion())
+ u.Log.Info("Current version is " + currentVersion)
u.Log.Info("New version is " + newVersion)
- if newVersion == u.Config.GetVersion() {
+ if newVersion == currentVersion {
return "", errors.New(u.Tr.SLocalize("OnLatestVersionErr"))
}
- if u.majorVersionDiffers(u.Config.GetVersion(), newVersion) {
- return "", errors.New(u.Tr.SLocalize("MajorVersionErr"))
+ if u.majorVersionDiffers(currentVersion, newVersion) {
+ errMessage := u.Tr.TemplateLocalize(
+ "MajorVersionErr",
+ i18n.Teml{
+ "newVersion": newVersion,
+ "currentVersion": currentVersion,
+ },
+ )
+ return "", errors.New(errMessage)
}
rawUrl, err := u.getBinaryUrl(newVersion)