Skip to content

Commit a00ae29

Browse files
committed
Merge pull request arduino#2633 from ffissore/better-error-message-when-serial-already-open
Better error message when opening serial monitor on a busy serial device
2 parents 7211eb0 + e385f67 commit a00ae29

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

app/src/processing/app/Editor.java

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import com.jcraft.jsch.JSchException;
2828

29+
import jssc.SerialPortException;
2930
import processing.app.debug.*;
3031
import processing.app.forms.PasswordAuthorizationDialog;
3132
import processing.app.helpers.OSUtils;
@@ -2572,6 +2573,12 @@ public void handleSerial() {
25722573
statusError(_("Unable to connect: is the sketch using the bridge?"));
25732574
} catch (JSchException e) {
25742575
statusError(_("Unable to connect: wrong password?"));
2576+
} catch (SerialException e) {
2577+
String errorMessage = e.getMessage();
2578+
if (e.getCause() != null && e.getCause() instanceof SerialPortException) {
2579+
errorMessage += " (" + ((SerialPortException) e.getCause()).getExceptionType() + ")";
2580+
}
2581+
statusError(errorMessage);
25752582
} catch (Exception e) {
25762583
statusError(e);
25772584
} finally {

0 commit comments

Comments
 (0)