mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-15 16:33:40 +00:00
main: differentiate between various serial/USB error messages
This way it is possible to determine the source of an error when it happens.
This commit is contained in:
committed by
Ron Evans
parent
15c7d93ea9
commit
46ccb6793e
@@ -598,7 +598,7 @@ func getDefaultPort() (port string, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if out.String() == "No Instance(s) Available." {
|
if out.String() == "No Instance(s) Available." {
|
||||||
return "", errors.New("unable to locate a USB device to be flashed")
|
return "", errors.New("no serial ports available")
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, line := range strings.Split(out.String(), "\n") {
|
for _, line := range strings.Split(out.String(), "\n") {
|
||||||
@@ -609,7 +609,7 @@ func getDefaultPort() (port string, err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "", errors.New("unable to locate a USB device to be flashed")
|
return "", errors.New("unable to locate a serial port")
|
||||||
default:
|
default:
|
||||||
return "", errors.New("unable to search for a default USB device to be flashed on this OS")
|
return "", errors.New("unable to search for a default USB device to be flashed on this OS")
|
||||||
}
|
}
|
||||||
@@ -619,7 +619,7 @@ func getDefaultPort() (port string, err error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
if d == nil {
|
if d == nil {
|
||||||
return "", errors.New("unable to locate a USB device to be flashed")
|
return "", errors.New("unable to locate a serial port")
|
||||||
}
|
}
|
||||||
|
|
||||||
return d[0], nil
|
return d[0], nil
|
||||||
|
|||||||
Reference in New Issue
Block a user