Skip to content

Commit 81fa396

Browse files
committed
return a specific error if core is up to date
1 parent 189737a commit 81fa396

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

commands/core/upgrade.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ import (
2828
rpc "github.com/arduino/arduino-cli/rpc/commands"
2929
)
3030

31+
var (
32+
// ErrAlreadyLatest is returned when an upgrade is not possible because
33+
// already at latest version.
34+
ErrAlreadyLatest = errors.New("platform already at latest version")
35+
)
36+
3137
// PlatformUpgrade FIXMEDOC
3238
func PlatformUpgrade(ctx context.Context, req *rpc.PlatformUpgradeReq,
3339
downloadCB commands.DownloadProgressCB, taskCB commands.TaskProgressCB, downloaderHeaders http.Header) (*rpc.PlatformUpgradeResp, error) {
@@ -71,7 +77,7 @@ func upgradePlatform(pm *packagemanager.PackageManager, platformRef *packagemana
7177
}
7278
latest := platform.GetLatestRelease()
7379
if !latest.Version.GreaterThan(installed.Version) {
74-
return fmt.Errorf("platform %s is already at the latest version", platformRef)
80+
return ErrAlreadyLatest
7581
}
7682
platformRef.PlatformVersion = latest.Version
7783
toInstallRefs = append(toInstallRefs, platformRef)

0 commit comments

Comments
 (0)