Skip to content

Commit 772c6a8

Browse files
committed
Sligthly improved error print in board attach
1 parent 3512bab commit 772c6a8

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

commands/board/attach.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ func runAttachCommand(cmd *cobra.Command, args []string) {
131131
// TODO: Handle the case when no board is found.
132132
board := findBoardFunc(pm, monitor, deviceURI)
133133
if board == nil {
134+
formatter.PrintErrorMessage("No supported board has been found at " + deviceURI.String() + ", try either install new cores or check your board URI.")
134135
os.Exit(commands.ErrGeneric)
135136
}
136137
formatter.Print("Board found: " + board.Name())
@@ -164,13 +165,11 @@ func findSerialConnectedBoard(pm *packagemanager.PackageManager, monitor *discov
164165
}
165166
}
166167
if !found {
167-
formatter.PrintErrorMessage("Sorry, no Supported board has been found at the specified board URI :-(")
168168
return nil
169169
}
170170

171171
boards := pm.FindBoardsWithVidPid(serialDevice.VendorID, serialDevice.ProductID)
172172
if len(boards) == 0 {
173-
formatter.PrintErrorMessage("No Supported board has been found, try either install new cores or check your board URI.")
174173
os.Exit(commands.ErrGeneric)
175174
}
176175

@@ -193,14 +192,12 @@ func findNetworkConnectedBoard(pm *packagemanager.PackageManager, monitor *disco
193192
}
194193
}
195194
if !found {
196-
formatter.PrintErrorMessage("No Supported board has been found at the specified board URI, try either install new cores or check your board URI.")
197-
os.Exit(commands.ErrGeneric)
195+
return nil
198196
}
199197

200198
boards := pm.FindBoardsWithID(networkDevice.Name)
201199
if len(boards) == 0 {
202-
formatter.PrintErrorMessage("No Supported board has been found, try either install new cores or check your board URI.")
203-
os.Exit(commands.ErrGeneric)
200+
return nil
204201
}
205202

206203
return boards[0]

0 commit comments

Comments
 (0)