Skip to content

Commit 46ccb67

Browse files
aykevldeadprogram
authored andcommitted
main: differentiate between various serial/USB error messages
This way it is possible to determine the source of an error when it happens.
1 parent 15c7d93 commit 46ccb67

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ func getDefaultPort() (port string, err error) {
598598
}
599599

600600
if out.String() == "No Instance(s) Available." {
601-
return "", errors.New("unable to locate a USB device to be flashed")
601+
return "", errors.New("no serial ports available")
602602
}
603603

604604
for _, line := range strings.Split(out.String(), "\n") {
@@ -609,7 +609,7 @@ func getDefaultPort() (port string, err error) {
609609
}
610610
}
611611
}
612-
return "", errors.New("unable to locate a USB device to be flashed")
612+
return "", errors.New("unable to locate a serial port")
613613
default:
614614
return "", errors.New("unable to search for a default USB device to be flashed on this OS")
615615
}
@@ -619,7 +619,7 @@ func getDefaultPort() (port string, err error) {
619619
return "", err
620620
}
621621
if d == nil {
622-
return "", errors.New("unable to locate a USB device to be flashed")
622+
return "", errors.New("unable to locate a serial port")
623623
}
624624

625625
return d[0], nil

0 commit comments

Comments
 (0)