From c4c146288259f9e15880bdfb3514c70a6f7a03cf Mon Sep 17 00:00:00 2001 From: Joel Moniz Date: Fri, 15 Aug 2014 22:15:23 +0530 Subject: [PATCH] Made errors a little more helpful Also, Hide stack traces when error message provided --- .../app/contrib/ContributionManager.java | 22 ++++++++++++++++--- .../contrib/ContributionManagerDialog.java | 1 - .../processing/app/languages/PDE.properties | 6 +++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/app/src/processing/app/contrib/ContributionManager.java b/app/src/processing/app/contrib/ContributionManager.java index 034246be7..b64c42556 100644 --- a/app/src/processing/app/contrib/ContributionManager.java +++ b/app/src/processing/app/contrib/ContributionManager.java @@ -102,7 +102,8 @@ public class ContributionManager { } catch (IOException ioe) { if (progress != null) progress.error(ioe); - ioe.printStackTrace(); + // Hiding stack trace. An error has been shown where needed. +// ioe.printStackTrace(); } if (progress != null) progress.finished(); @@ -155,11 +156,26 @@ public class ContributionManager { } installProgress.finished(); } + else { + if (downloadProgress.exception instanceof SocketTimeoutException) { + status.setErrorMessage(Language + .interpolate("contrib.errors.contrib_download.timeout", + ad.getName())); + } else { + status.setErrorMessage(Language + .interpolate("contrib.errors.download_and_install", + ad.getName())); + } + } contribZip.delete(); } catch (Exception e) { - e.printStackTrace(); - status.setErrorMessage(Language.text("contrib.errors.download_and_install")); + // Hiding stack trace. The error message ought to suffice. +// e.printStackTrace(); + status + .setErrorMessage(Language + .interpolate("contrib.errors.download_and_install", + ad.getName())); } } catch (IOException e) { status.setErrorMessage(Language.text("contrib.errors.temporary_directory")); diff --git a/app/src/processing/app/contrib/ContributionManagerDialog.java b/app/src/processing/app/contrib/ContributionManagerDialog.java index 82d4d79ad..6065b75dd 100644 --- a/app/src/processing/app/contrib/ContributionManagerDialog.java +++ b/app/src/processing/app/contrib/ContributionManagerDialog.java @@ -411,7 +411,6 @@ public class ContributionManagerDialog { } } - protected void setFilterText(String filter) { if (filter == null || filter.isEmpty()) { filterField.setText(""); diff --git a/app/src/processing/app/languages/PDE.properties b/app/src/processing/app/languages/PDE.properties index fa80b739d..aaa592413 100644 --- a/app/src/processing/app/languages/PDE.properties +++ b/app/src/processing/app/languages/PDE.properties @@ -269,15 +269,17 @@ contrib.messages.install_restart = Please restart Processing to finish installin contrib.messages.update_restart = Please restart Processing to finish updating this item. contrib.errors.list_download = Could not download the list of available contributions. contrib.errors.list_download.timeout = Connection timed out while downloading the contribution list. -contrib.errors.download_and_install = Error during download and install. +contrib.errors.download_and_install = Error during download and install of %s. contrib.errors.description_unavailable = Description unavailable. -contrib.errors.malformed_url = "The link fetched from Processing.org is not valid.\nYou can still install this library manually by visiting\nthe library's website. +contrib.errors.malformed_url = The link fetched from Processing.org is not valid.\nYou can still install this library manually by visiting\nthe library's website. contrib.errors.needs_repackage = %s needs to be repackaged according to the %s guidelines. contrib.errors.no_contribution_found = Could not find a %s in the downloaded file. contrib.errors.overwriting_properties = Error overwriting .properties file. contrib.errors.install_failed = Install failed. contrib.errors.update_on_restart_failed = Update on restart of %s failed. contrib.errors.temporary_directory = Could not write to temporary directory. +contrib.errors.contrib_download.timeout = Connection timed out while downloading %s. +contrib.errors.no_internet_connection = You don't seem to be connected to the Internet. contrib.all = All contrib.undo = Undo contrib.remove = Remove