Skip to content

Commit 257238c

Browse files
committed
IDE: better error handling for upload/burn bootloader
RunnerException was displayed with an ugly stacktrace, while the message contained in the exception itself is already quite enough detailed and clear.
1 parent 85aecfe commit 257238c

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

app/src/processing/app/Editor.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -2573,7 +2573,8 @@ public void run() {
25732573
statusError(I18n.format(
25742574
_("Error while burning bootloader: missing '{0}' configuration parameter"),
25752575
e.getMessage()));
2576-
//statusError(e);
2576+
} catch (RunnerException e) {
2577+
statusError(e.getMessage());
25772578
} catch (Exception e) {
25782579
statusError(_("Error while burning bootloader."));
25792580
e.printStackTrace();

arduino-core/src/cc/arduino/packages/uploaders/SerialUploader.java

+8-14
Original file line numberDiff line numberDiff line change
@@ -322,19 +322,13 @@ public boolean burnBootloader() throws Exception {
322322
prefs.put("bootloader.verbose", prefs.getOrExcept("bootloader.params.quiet"));
323323
}
324324

325-
try {
326-
String pattern = prefs.getOrExcept("erase.pattern");
327-
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
328-
if (!executeUploadCommand(cmd))
329-
return false;
330-
331-
pattern = prefs.getOrExcept("bootloader.pattern");
332-
cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
333-
return executeUploadCommand(cmd);
334-
} catch (RunnerException e) {
335-
throw e;
336-
} catch (Exception e) {
337-
throw new RunnerException(e);
338-
}
325+
String pattern = prefs.getOrExcept("erase.pattern");
326+
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
327+
if (!executeUploadCommand(cmd))
328+
return false;
329+
330+
pattern = prefs.getOrExcept("bootloader.pattern");
331+
cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
332+
return executeUploadCommand(cmd);
339333
}
340334
}

0 commit comments

Comments
 (0)