From 9b0dade9e1730db715aec7f502fe894d819c154b Mon Sep 17 00:00:00 2001 From: Nathanael Jourdane Date: Thu, 12 May 2016 18:29:26 +0200 Subject: [PATCH] Improve error displaying. --- src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapController.java | 6 +++--- src/main/java/eu/omp/irap/vespa/epntapclient/gui/GUIController.java | 13 +++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapController.java b/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapController.java index 743b215..537d27b 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapController.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapController.java @@ -64,12 +64,12 @@ public class EpnTapController { try { servicesCtrl.readTable(); } catch (CantGetVOTableException e) { - displayError(e); + displayError("Can not get services.", e); } } - public void displayError(Exception e) { - logger.log(Level.SEVERE, "Can not get services.", e); + public void displayError(String message, Exception e) { + logger.log(Level.SEVERE, message, e); } public String sendQuery(String query, String tableServiceURL) diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/GUIController.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/GUIController.java index 82879d0..976d276 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/GUIController.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/GUIController.java @@ -58,7 +58,7 @@ public class GUIController extends EpnTapController implements ViewListener { try { servicesCtrl.readTable(); } catch (CantGetVOTableException e) { - displayError(e); + displayError("Can not get services.", e); } mainView.getServicesPanel().fillTable(servicesCtrl.getVOTableData()); } @@ -82,16 +82,17 @@ public class GUIController extends EpnTapController implements ViewListener { try { voTablePath = sendQuery(query, selectedTableServiceURL); } catch (CantGetVOTableException e) { - // TODO create exception - mainView.displayError("Can not send query.", e.getMessage()); + displayError("Can not send the query.", e); GUIController.logger.log(Level.WARNING, "Can not send query.", e); } + + mainView.getResultsPanel().fillTable(resultsCtrl.getVOTableData()); } @Override - public void displayError(Exception e) { - JOptionPane.showMessageDialog(mainView, "Error", e.getMessage(), JOptionPane.ERROR_MESSAGE, - null); + public void displayError(String message, Exception e) { + logger.log(Level.SEVERE, message, e); + JOptionPane.showMessageDialog(mainView, e.getMessage(), message, JOptionPane.ERROR_MESSAGE); } /** Copy the VOTable to a specified location. */ -- libgit2 0.21.2