mirror of
https://github.com/esp8266/Arduino.git
synced 2025-08-09 22:24:14 +03:00
Merge pull request #2633 from ffissore/better-error-message-when-serial-already-open
Better error message when opening serial monitor on a busy serial device
This commit is contained in:
@@ -26,6 +26,7 @@ import cc.arduino.packages.MonitorFactory;
|
|||||||
|
|
||||||
import com.jcraft.jsch.JSchException;
|
import com.jcraft.jsch.JSchException;
|
||||||
|
|
||||||
|
import jssc.SerialPortException;
|
||||||
import processing.app.debug.*;
|
import processing.app.debug.*;
|
||||||
import processing.app.forms.PasswordAuthorizationDialog;
|
import processing.app.forms.PasswordAuthorizationDialog;
|
||||||
import processing.app.helpers.OSUtils;
|
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?"));
|
statusError(_("Unable to connect: is the sketch using the bridge?"));
|
||||||
} catch (JSchException e) {
|
} catch (JSchException e) {
|
||||||
statusError(_("Unable to connect: wrong password?"));
|
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) {
|
} catch (Exception e) {
|
||||||
statusError(e);
|
statusError(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
Reference in New Issue
Block a user