changeset 26651:c88871c44c56

Emit a more useful error message when gnuplot executable is broken (bug #55558). * __gnuplot_has_feature__.m: Remove try/catch block around call to __gnuplot_version__ (). * __gnuplot_version__.m: Change error message when gnuplot executable doesn't work to state the problem clearly and provide the name of the executable that Octave attempted to use.
author Rik <rik@octave.org>
date Sun, 27 Jan 2019 21:53:56 -0800
parents edb11e68b571
children a569b5391347
files scripts/plot/util/private/__gnuplot_has_feature__.m scripts/plot/util/private/__gnuplot_version__.m
diffstat 2 files changed, 2 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/private/__gnuplot_has_feature__.m	Sun Jan 27 16:21:18 2019 +0100
+++ b/scripts/plot/util/private/__gnuplot_has_feature__.m	Sun Jan 27 21:53:56 2019 -0800
@@ -37,12 +37,7 @@
   persistent has_features;
 
   if (isempty (has_features))
-    try
-      gnuplot_version = __gnuplot_version__ ();
-    catch
-      ## Don't throw an error if gnuplot isn't installed
-      gnuplot_version = "0.0.0";
-    end_try_catch
+    gnuplot_version = __gnuplot_version__ ();
     versions  = {"4.4", "4.6", "5.0", "4.6", "4.6", "5.0", "5.0", "5.0"};
     operators = {">=" , ">=" , ">=" , ">=" , ">=" , ">=" , ">=" , ">=" };
     have_features = false (size (features));
--- a/scripts/plot/util/private/__gnuplot_version__.m	Sun Jan 27 16:21:18 2019 +0100
+++ b/scripts/plot/util/private/__gnuplot_version__.m	Sun Jan 27 21:53:56 2019 -0800
@@ -36,7 +36,7 @@
       ## are skipped and people might actually see the message, read it,
       ## comprehend it, take the advice it gives, and stop asking us
       ## why plotting fails when gnuplot is not found.
-      error ("you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function\n");
+      error ("The gnuplot executable '%s' was not found or does not work.  If you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function\n", gnuplot_binary ());
     endif
     output = strrep (output, "gnuplot", "");
     output = strrep (output, "patchlevel", ".");