mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-16 02:18:44 -07:00
Improve upgrade error messages
This commit is contained in:
parent
bd4a14519c
commit
9edf8233f7
@ -30,7 +30,8 @@ type Asset struct {
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
ErrVersionUpToDate = errors.New("current version is up to date")
|
ErrVersionUpToDate = errors.New("current version is up to date")
|
||||||
ErrVersionUnknown = errors.New("couldn't fetch release information")
|
ErrNoReleaseDownload = errors.New("couldn't find a release to download")
|
||||||
|
ErrNoVersionToSelect = errors.New("no version to select")
|
||||||
ErrUpgradeUnsupported = errors.New("upgrade unsupported")
|
ErrUpgradeUnsupported = errors.New("upgrade unsupported")
|
||||||
ErrUpgradeInProgress = errors.New("upgrade already in progress")
|
ErrUpgradeInProgress = errors.New("upgrade already in progress")
|
||||||
upgradeUnlocked = make(chan bool, 1)
|
upgradeUnlocked = make(chan bool, 1)
|
||||||
|
@ -49,7 +49,7 @@ var insecureHTTP = &http.Client{
|
|||||||
|
|
||||||
// FetchLatestReleases returns the latest releases, including prereleases or
|
// FetchLatestReleases returns the latest releases, including prereleases or
|
||||||
// not depending on the argument
|
// not depending on the argument
|
||||||
func FetchLatestReleases(releasesURL, version string) ([]Release) {
|
func FetchLatestReleases(releasesURL, version string) []Release {
|
||||||
resp, err := insecureHTTP.Get(releasesURL)
|
resp, err := insecureHTTP.Get(releasesURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.Infoln("Couldn't fetch release information:", err)
|
l.Infoln("Couldn't fetch release information:", err)
|
||||||
@ -86,7 +86,7 @@ func LatestRelease(releasesURL, version string) (Release, error) {
|
|||||||
|
|
||||||
func SelectLatestRelease(version string, rels []Release) (Release, error) {
|
func SelectLatestRelease(version string, rels []Release) (Release, error) {
|
||||||
if len(rels) == 0 {
|
if len(rels) == 0 {
|
||||||
return Release{}, ErrVersionUnknown
|
return Release{}, ErrNoVersionToSelect
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Sort(SortByRelease(rels))
|
sort.Sort(SortByRelease(rels))
|
||||||
@ -108,7 +108,7 @@ func SelectLatestRelease(version string, rels []Release) (Release, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Release{}, ErrVersionUnknown
|
return Release{}, ErrNoReleaseDownload
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upgrade to the given release, saving the previous binary with a ".old" extension.
|
// Upgrade to the given release, saving the previous binary with a ".old" extension.
|
||||||
@ -124,7 +124,7 @@ func upgradeTo(binary string, rel Release) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ErrVersionUnknown
|
return ErrNoReleaseDownload
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upgrade to the given release, saving the previous binary with a ".old" extension.
|
// Upgrade to the given release, saving the previous binary with a ".old" extension.
|
||||||
|
Loading…
Reference in New Issue
Block a user