# HG changeset patch # User John W. Eaton # Date 1291940640 18000 # Node ID 892ef3688ccf5c8ed7b73610dc2aec7aaa0a8574 # Parent 24cbdeac83848f23b48d61212517ae7486995956 __pie__.m: improve error messages diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,9 @@ +2010-12-09 John W. Eaton + + * plot/private/__pie__.m: Provide diagnositc for invalid + optional arguments. Use caller name instead of __pie__ in error + messages. + 2010-12-09 John W. Eaton * statistics/tests/kolmogorov_smirnov_test.m: Try both DIST_cdf diff --git a/scripts/plot/private/__pie__.m b/scripts/plot/private/__pie__.m --- a/scripts/plot/private/__pie__.m +++ b/scripts/plot/private/__pie__.m @@ -29,7 +29,7 @@ iarg = 3; if (! isvector (x)) - error ("__pie__: expecting vector argument"); + error ("%s: expecting vector argument", caller); endif len = length (x); @@ -43,14 +43,17 @@ labels = arg; have_labels = true; if (numel (x) != numel (labels)) - error ("__pie__: mismatch in number of labels and data"); + error ("%s: mismatch in number of labels and data", caller); endif - elseif (! ischar (arg)) + elseif (isnumeric (arg) || islogical (arg)) explode = arg; have_explode = true; if (! size_equal (x, explode)) - error ("__pie__: mismatch in number of elements in explode and data"); + error ("%s: mismatch in number of elements in explode and data", + caller); endif + else + error ("%s: %s is invalid as an optional argument", caller, class (arg)); endif endwhile @@ -122,7 +125,7 @@ text(xt, yt, labels{i}, "horizontalalignment", align)]; else - error ("__pie__: unknown caller"); + error ("__pie__: unknown caller `%s'", caller); endif endfor