From 257238c050ed2fc7ed53cf71c98d8136e8f3f412 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 20 Nov 2014 14:00:43 +0100 Subject: [PATCH] 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. --- app/src/processing/app/Editor.java | 3 ++- .../packages/uploaders/SerialUploader.java | 20 +++++++------------ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index 83a4a8a11..47ab58e79 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -2573,7 +2573,8 @@ public class Editor extends JFrame implements RunnerListener { statusError(I18n.format( _("Error while burning bootloader: missing '{0}' configuration parameter"), e.getMessage())); - //statusError(e); + } catch (RunnerException e) { + statusError(e.getMessage()); } catch (Exception e) { statusError(_("Error while burning bootloader.")); e.printStackTrace(); diff --git a/arduino-core/src/cc/arduino/packages/uploaders/SerialUploader.java b/arduino-core/src/cc/arduino/packages/uploaders/SerialUploader.java index 8968e678f..bced0adda 100644 --- a/arduino-core/src/cc/arduino/packages/uploaders/SerialUploader.java +++ b/arduino-core/src/cc/arduino/packages/uploaders/SerialUploader.java @@ -322,19 +322,13 @@ public class SerialUploader extends Uploader { prefs.put("bootloader.verbose", prefs.getOrExcept("bootloader.params.quiet")); } - try { - String pattern = prefs.getOrExcept("erase.pattern"); - String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true); - if (!executeUploadCommand(cmd)) - return false; + String pattern = prefs.getOrExcept("erase.pattern"); + String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true); + if (!executeUploadCommand(cmd)) + return false; - pattern = prefs.getOrExcept("bootloader.pattern"); - cmd = StringReplacer.formatAndSplit(pattern, prefs, true); - return executeUploadCommand(cmd); - } catch (RunnerException e) { - throw e; - } catch (Exception e) { - throw new RunnerException(e); - } + pattern = prefs.getOrExcept("bootloader.pattern"); + cmd = StringReplacer.formatAndSplit(pattern, prefs, true); + return executeUploadCommand(cmd); } }