Skip to content

Commit 5183013

Browse files
committed
More friendly error message on port open() failure
Fixes #19
1 parent 83fd7bc commit 5183013

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/cc/arduino/plugins/wifi101/flashers/java/FlasherSerialClient.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,12 @@ public void open(String portName) throws SerialException, InterruptedException {
9494
Thread.sleep(2500);
9595
}
9696

97-
public void close() throws SerialPortException {
98-
port.closePort();
97+
public void close() throws SerialException {
98+
try {
99+
port.closePort();
100+
} catch (Exception e) {
101+
throw new SerialException(format(tr("Error opening serial port.\nClose the serial monitor (if open) or any program using port '{0}'"), port.getPortName()));
102+
}
99103
}
100104

101105
public void hello() throws Exception {

0 commit comments

Comments
 (0)