Skip to content

Commit c4e1458

Browse files
author
Federico Fissore
committed
Providing a more meaningful error message when attempting to open serial monitor and linux user misses permission on device. Fixes #2100
1 parent bc05c40 commit c4e1458

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arduino-core/src/processing/app/Serial.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ public Serial(String iname, int irate, char iparity, int idatabits, float istopb
123123
port.openPort();
124124
port.setParams(rate, databits, stopbits, parity, true, true);
125125
port.addEventListener(this);
126-
} catch (Exception e) {
126+
} catch (SerialPortException e) {
127+
if (e.getPortName().startsWith("/dev") && SerialPortException.TYPE_PERMISSION_DENIED.equals(e.getExceptionType())) {
128+
throw new SerialException(I18n.format(_("Error opening serial port ''{0}''. Try consulting the documentation at http://playground.arduino.cc/Linux/All#Permission"), iname));
129+
}
127130
throw new SerialException(I18n.format(_("Error opening serial port ''{0}''."), iname), e);
128131
}
129132

0 commit comments

Comments
 (0)