Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 537807b

Browse files
committedJun 14, 2023
use errors.As in case in the future the err coming from PlatformUpgrade might be wrapped
errors.As search through all the wrapped error for our target type, in case it finds it then it popolate that struct but more important we can use it as a type assertion even if is nested through many errors
1 parent 27f9b05 commit 537807b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎internal/cli/core/upgrade.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package core
1717

1818
import (
1919
"context"
20+
"errors"
2021
"fmt"
2122
"os"
2223

@@ -109,7 +110,8 @@ func Upgrade(inst *rpc.Instance, args []string, skipPostInstall bool) {
109110
response, err := core.PlatformUpgrade(context.Background(), r, feedback.ProgressBar(), feedback.TaskProgress())
110111
warningMissingIndex(response)
111112
if err != nil {
112-
if _, ok := err.(*arduino.PlatformAlreadyAtTheLatestVersionError); ok {
113+
var alreadyAtLatestVersionErr *arduino.PlatformAlreadyAtTheLatestVersionError
114+
if errors.As(err, &alreadyAtLatestVersionErr) {
113115
feedback.Warning(err.Error())
114116
continue
115117
}

0 commit comments

Comments
 (0)
Please sign in to comment.