From e385f67fce1f7e68579420410a32ff6c5df9e4ef Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Thu, 12 Feb 2015 10:20:27 +0100 Subject: [PATCH] Better error message when opening serial monitor on a busy serial device. Closes #2632 --- app/src/processing/app/Editor.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index 7d3b9b0de..af95a8fcc 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -26,6 +26,7 @@ import cc.arduino.packages.MonitorFactory; import com.jcraft.jsch.JSchException; +import jssc.SerialPortException; import processing.app.debug.*; import processing.app.forms.PasswordAuthorizationDialog; import processing.app.helpers.OSUtils; @@ -2572,6 +2573,12 @@ public class Editor extends JFrame implements RunnerListener { statusError(_("Unable to connect: is the sketch using the bridge?")); } catch (JSchException e) { statusError(_("Unable to connect: wrong password?")); + } catch (SerialException e) { + String errorMessage = e.getMessage(); + if (e.getCause() != null && e.getCause() instanceof SerialPortException) { + errorMessage += " (" + ((SerialPortException) e.getCause()).getExceptionType() + ")"; + } + statusError(errorMessage); } catch (Exception e) { statusError(e); } finally {