reporting: make errors more clear
parent
8d36cc802c
commit
18ed9daafe
|
@ -33,10 +33,10 @@ switch nargin
|
|||
e = class(struct, 'elements', objArray());
|
||||
case 1
|
||||
assert(isa(varargin{1}, 'elements'), ...
|
||||
['With one arg to elements constructor, you must pass an ' ...
|
||||
'elements object or a char.']);
|
||||
['@elements.elements: with one arg, you must pass an elements ' ...
|
||||
'object or a char.']);
|
||||
e = varargin{1};
|
||||
otherwise
|
||||
error('Elements constructor: invalid number of arguments');
|
||||
error('@elements.elements: invalid number of arguments');
|
||||
end
|
||||
end
|
|
@ -34,6 +34,6 @@ switch S.type
|
|||
assert(isnumeric(index));
|
||||
B.objArray(index) = V;
|
||||
otherwise
|
||||
error('Elements subsasign syntax error')
|
||||
error('@elements.subsasign: syntax error');
|
||||
end
|
||||
end
|
|
@ -31,14 +31,14 @@ switch S(1).type
|
|||
A = feval(S(1).subs, A);
|
||||
end
|
||||
otherwise
|
||||
error(['Elements Class: unknown field or method: ' S(1).subs]);
|
||||
error(['@elements.subsref: unknown field or method: ' S(1).subs]);
|
||||
end
|
||||
case '()'
|
||||
A = getElements(A, S(1).subs{:});
|
||||
case '{}'
|
||||
error(['Elements Class: ' S(1).type ' indexing not supported.']);
|
||||
error(['@elements.subsref: ' S(1).type ' indexing not supported.']);
|
||||
otherwise
|
||||
error('Elements Class: subsref.m impossible case')
|
||||
error('@elements.subsref: impossible case');
|
||||
end
|
||||
|
||||
S = shiftS(S);
|
||||
|
|
|
@ -32,7 +32,8 @@ assert(~isempty(o.data));
|
|||
assert(isa(o.data, 'dynSeries')) ;
|
||||
|
||||
if ~isempty(o.figname)
|
||||
warning('Will overwrite %s with new graph\n', o.figname);
|
||||
warning('@graph.createGraph: will overwrite %s with new graph\n', ...
|
||||
o.figname);
|
||||
end
|
||||
|
||||
%o = readConfig(o);
|
||||
|
@ -66,10 +67,12 @@ if ~isempty(o.shade)
|
|||
yrange = get(gca, 'YLim');
|
||||
|
||||
if isempty(x1)
|
||||
error([o.shade{1} ' not in date range of provided data']);
|
||||
error(['@graph.createGraph: ' o.shade{1} ' not in date range of ' ...
|
||||
'provided data']);
|
||||
end
|
||||
if isempty(x2)
|
||||
error([o.shade{2} ' not in date range of provided data']);
|
||||
error(['@graph.createGraph: ' o.shade{2} ' not in date range of ' ...
|
||||
'provided data']);
|
||||
end
|
||||
|
||||
% From ShadePlotForEmpahsis (Matlab Exchange)
|
||||
|
|
|
@ -52,13 +52,13 @@ o.legend_orientation = 'horizontal';
|
|||
o.legend_font_size = 8;
|
||||
|
||||
if nargin == 1
|
||||
assert(isa(varargin{1}, 'graph'),['With one arg to Graph constructor, ' ...
|
||||
'you must pass a graph object']);
|
||||
assert(isa(varargin{1}, 'graph'),['@graph.graph: with one arg you ' ...
|
||||
'must pass a graph object']);
|
||||
o = varargin{1};
|
||||
return;
|
||||
elseif nargin > 1
|
||||
if round(nargin/2) ~= nargin/2
|
||||
error(['Options to Graph constructor must be supplied in name/value ' ...
|
||||
error(['@graph.graph: options must be supplied in name/value ' ...
|
||||
'pairs.']);
|
||||
end
|
||||
|
||||
|
@ -70,8 +70,7 @@ elseif nargin > 1
|
|||
if any(strmatch(field, optNames, 'exact'))
|
||||
o.(field) = pair{2};
|
||||
else
|
||||
error('%s is not a recognized option to the Graph constructor.', ...
|
||||
field);
|
||||
error('@graph.graph: %s is not a recognized option.', field);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,9 +34,9 @@ switch S.type
|
|||
case fieldnames(A)
|
||||
B.(S.subs) = V;
|
||||
otherwise
|
||||
error(['field ' S.subs 'does not exist in the page class'])
|
||||
error(['@graph.subsasgn: field ' S.subs 'does not exist']);
|
||||
end
|
||||
otherwise
|
||||
error('report subsasign syntax error')
|
||||
error('@graph.subsasgn: syntax error');
|
||||
end
|
||||
end
|
|
@ -31,12 +31,12 @@ switch S(1).type
|
|||
A = feval(S(1).subs, A);
|
||||
end
|
||||
otherwise
|
||||
error(['Graph Class: unknown field or method: ' S(1).subs]);
|
||||
error(['@graph.subsref: unknown field or method: ' S(1).subs]);
|
||||
end
|
||||
case {'()', '{}'}
|
||||
error(['Graph Class: ' S(1).type ' indexing not supported.']);
|
||||
error(['@graph.subsref: ' S(1).type ' indexing not supported.']);
|
||||
otherwise
|
||||
error('Graph Class: subsref.m impossible case')
|
||||
error('@graph.subsref: impossible case')
|
||||
end
|
||||
|
||||
S = shiftS(S);
|
||||
|
|
|
@ -25,6 +25,6 @@ switch nargin
|
|||
assert(isnumeric(varargin{1}));
|
||||
e = oa.objs{varargin{1}};
|
||||
otherwise
|
||||
error('objArray getObjs: invalid number of arguments');
|
||||
error('@objArray.getObjs: invalid number of arguments');
|
||||
end
|
||||
end
|
|
@ -34,10 +34,10 @@ switch nargin
|
|||
oa.objs = cell(0);
|
||||
oa = class(oa, 'objArray');
|
||||
case 1
|
||||
assert(isa(varargin{1}, 'objArray'), ['ObjArray constructor: the only ' ...
|
||||
assert(isa(varargin{1}, 'objArray'), ['@objArray.objArray: the only ' ...
|
||||
'valid arguments are objArray objects']);
|
||||
oa = varargin{1};
|
||||
otherwise
|
||||
error('ObjArray constructor: invalid number of arguments');
|
||||
error('@objArray.objArray: invalid number of arguments');
|
||||
end
|
||||
end
|
|
@ -34,6 +34,6 @@ switch S.type
|
|||
assert(isnumeric(index));
|
||||
B.objs{index} = V;
|
||||
otherwise
|
||||
error('objArray subsasgn syntax error')
|
||||
error('objArray.subsasgn: syntax error');
|
||||
end
|
||||
end
|
|
@ -31,14 +31,14 @@ switch S(1).type
|
|||
A = feval(S(1).subs, A);
|
||||
end
|
||||
otherwise
|
||||
error(['ObjArray Class: unknown field or method: ' S(1).subs]);
|
||||
error(['objArray.subsref: unknown field or method: ' S(1).subs]);
|
||||
end
|
||||
case '()'
|
||||
A = getObjs(A, S(1).subs{:});
|
||||
case '{}'
|
||||
error(['ObjArray Class: ' S(1).type ' indexing not supported.']);
|
||||
error(['objArray.subsref: ' S(1).type ' indexing not supported.']);
|
||||
otherwise
|
||||
error('ObjArray Class: subsref.m impossible case')
|
||||
error('objArray.subsref: impossible case')
|
||||
end
|
||||
|
||||
S = shiftS(S);
|
||||
|
|
|
@ -37,13 +37,13 @@ o.footnote = '';
|
|||
o.sections = sections();
|
||||
|
||||
if nargin == 1
|
||||
assert(isa(varargin{1}, 'page'), ['With one arg to Page constructor, ' ...
|
||||
'you must pass a page object']);
|
||||
assert(isa(varargin{1}, 'page'), ['@page.page: with one arg to Page ' ...
|
||||
'constructor, you must pass a page object']);
|
||||
o = varargin{1};
|
||||
return;
|
||||
elseif nargin > 1
|
||||
if round(nargin/2) ~= nargin/2
|
||||
error(['Options to Page constructor must be supplied in name/value ' ...
|
||||
error(['@page.page: options must be supplied in name/value ' ...
|
||||
'pairs.']);
|
||||
end
|
||||
|
||||
|
@ -55,8 +55,7 @@ elseif nargin > 1
|
|||
if any(strmatch(field, optNames, 'exact'))
|
||||
o.(field) = pair{2};
|
||||
else
|
||||
error('%s is not a recognized option to the Page constructor.', ...
|
||||
field);
|
||||
error('@page.page: %s is not a recognized option.', field);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,9 +38,9 @@ switch S.type
|
|||
case fieldnames(A)
|
||||
B.(S.subs) = V;
|
||||
otherwise
|
||||
error(['field ' S.subs 'does not exist in the page class'])
|
||||
error(['@page.subsasgn: field ' S.subs 'does not exist']);
|
||||
end
|
||||
otherwise
|
||||
error('report subsasign syntax error')
|
||||
error('@page.subsasgn: syntax error');
|
||||
end
|
||||
end
|
|
@ -31,14 +31,14 @@ switch S(1).type
|
|||
A = feval(S(1).subs, A);
|
||||
end
|
||||
otherwise
|
||||
error(['Page Class: unknown field or method: ' S(1).subs]);
|
||||
error(['@page.subsref: unknown field or method: ' S(1).subs]);
|
||||
end
|
||||
case '()'
|
||||
A = getSections(A, S(1).subs{:});
|
||||
case '{}'
|
||||
error(['Page Class: ' S(1).type ' indexing not supported.']);
|
||||
error(['@page.subsref: ' S(1).type ' indexing not supported.']);
|
||||
otherwise
|
||||
error('Page Class: subsref.m impossible case')
|
||||
error('@page.subsref: impossible case')
|
||||
end
|
||||
|
||||
S = shiftS(S);
|
||||
|
|
|
@ -33,10 +33,10 @@ switch nargin
|
|||
ps = class(struct, 'pages', objArray());
|
||||
case 1
|
||||
assert(isa(varargin{1}, 'pages'), ...
|
||||
['With one arg to pages constructor, you must pass an ' ...
|
||||
'pages object or a char.']);
|
||||
['@pages.pages: With one arg to pages constructor, you must ' ...
|
||||
'pass an pages object or a char.']);
|
||||
ps = varargin{1};
|
||||
otherwise
|
||||
error('Pages constructor: invalid number of arguments');
|
||||
error('@pages.pages: invalid number of arguments');
|
||||
end
|
||||
end
|
|
@ -34,6 +34,6 @@ switch S.type
|
|||
assert(isnumeric(index));
|
||||
B.objArray(index) = V;
|
||||
otherwise
|
||||
error('Pages subsasign syntax error');
|
||||
error('@pages.subsasgn: syntax error');
|
||||
end
|
||||
end
|
|
@ -31,14 +31,14 @@ switch S(1).type
|
|||
A = feval(S(1).subs, A);
|
||||
end
|
||||
otherwise
|
||||
error(['Pages Class: unknown field or method: ' S(1).subs]);
|
||||
error(['@pages.subsref: unknown field or method: ' S(1).subs]);
|
||||
end
|
||||
case '()'
|
||||
A = getPages(A, S(1).subs{:});
|
||||
case '{}'
|
||||
error(['Pages Class: ' S(1).type ' indexing not supported.']);
|
||||
error(['@pages.subsref: ' S(1).type ' indexing not supported.']);
|
||||
otherwise
|
||||
error('Pages Class: subsref.m impossible case')
|
||||
error('@pages.subsref: impossible case')
|
||||
end
|
||||
|
||||
S = shiftS(S);
|
||||
|
|
|
@ -41,14 +41,14 @@ o.config = '';
|
|||
o.showdate = true;
|
||||
|
||||
if nargin == 1
|
||||
assert(isa(varargin{1}, 'report'),['With one arg to Report constructor, ' ...
|
||||
assert(isa(varargin{1}, 'report'), ['@report.report: with one arg, ' ...
|
||||
'you must pass a report object']);
|
||||
r = varargin{1};
|
||||
return;
|
||||
elseif nargin > 1
|
||||
if round(nargin/2) ~= nargin/2
|
||||
error(['Options to Report constructor must be supplied in name/value ' ...
|
||||
'pairs.']);
|
||||
error(['@report.report: options must be supplied in name/value ' ...
|
||||
'pairs']);
|
||||
end
|
||||
|
||||
optNames = lower(fieldnames(o));
|
||||
|
@ -64,7 +64,7 @@ elseif nargin > 1
|
|||
end
|
||||
o.(field) = pair{2};
|
||||
else
|
||||
error('%s is not a recognized option to the Report constructor.', ...
|
||||
error('@report.report: %s is not a recognized option.', ...
|
||||
field);
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,9 +38,9 @@ switch S.type
|
|||
case fieldnames(A)
|
||||
B.(S.subs) = V;
|
||||
otherwise
|
||||
error(['field ' S.subs 'does not exist in the report class']);
|
||||
error(['@report.subsasgn: field ' S.subs 'does not exist']);
|
||||
end
|
||||
otherwise
|
||||
error('report subsasign syntax error');
|
||||
error('@report.subsasgn: syntax error');
|
||||
end
|
||||
end
|
|
@ -31,14 +31,14 @@ switch S(1).type
|
|||
A = feval(S(1).subs, A);
|
||||
end
|
||||
otherwise
|
||||
error(['Report Class: unknown field or method: ' S(1).subs]);
|
||||
error(['@report.subsasgn: unknown field or method: ' S(1).subs]);
|
||||
end
|
||||
case '()'
|
||||
A = A.pages.getPages(S(1).subs{:});
|
||||
case '{}'
|
||||
error(['Report Class: ' S(1).type ' indexing not supported.']);
|
||||
error(['@report.subsasgn: ' S(1).type ' indexing not supported.']);
|
||||
otherwise
|
||||
error('Report Class: subsref.m impossible case');
|
||||
error('@report.subsasgn: impossible case');
|
||||
end
|
||||
|
||||
S = shiftS(S);
|
||||
|
|
|
@ -30,7 +30,7 @@ function o = write(o)
|
|||
|
||||
[fid, msg] = fopen(o.filename, 'w');
|
||||
if fid == -1
|
||||
error(msg);
|
||||
error(['@report.subsasgn: ' msg]);
|
||||
end
|
||||
|
||||
fprintf(fid, '%% Report Object\n');
|
||||
|
@ -67,6 +67,6 @@ fprintf(fid, '\\end{document}\n');
|
|||
fprintf(fid, '%% End Report Object\n');
|
||||
status = fclose(fid);
|
||||
if status == -1
|
||||
error('Error closing %s\n', o.filename);
|
||||
error('@report.wrie: closing %s\n', o.filename);
|
||||
end
|
||||
end
|
|
@ -32,8 +32,8 @@ if nargin == 1
|
|||
return;
|
||||
elseif nargin > 1
|
||||
if round(nargin/2) ~= nargin/2
|
||||
error(['Options to Section constructor must be supplied in name/' ...
|
||||
'value pairs.']);
|
||||
error(['@section.section: options must be supplied in name/value ' ...
|
||||
'pairs.']);
|
||||
end
|
||||
|
||||
optNames = lower(fieldnames(o));
|
||||
|
@ -44,7 +44,7 @@ elseif nargin > 1
|
|||
if any(strmatch(field, optNames, 'exact'))
|
||||
o.(field) = pair{2};
|
||||
else
|
||||
error('%s is not a recognized option to the Section constructor.', ...
|
||||
error('@section.section: %s is not a recognized option.', ...
|
||||
field);
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,6 +34,6 @@ switch S.type
|
|||
assert(isnumeric(index));
|
||||
B(index) = V;
|
||||
otherwise
|
||||
error('objArray subsasign syntax error')
|
||||
error('@section.subsasgn: syntax error')
|
||||
end
|
||||
end
|
|
@ -31,14 +31,14 @@ switch S(1).type
|
|||
A = feval(S(1).subs, A);
|
||||
end
|
||||
otherwise
|
||||
error(['Section Class: unknown field or method: ' S(1).subs]);
|
||||
error(['@section.subsref: unknown field or method: ' S(1).subs]);
|
||||
end
|
||||
case '()'
|
||||
A = A.elements.getElements(S(1).subs{:});
|
||||
case '{}'
|
||||
error(['Section Class: ' S(1).type ' indexing not supported.']);
|
||||
error(['@section.subsref: ' S(1).type ' indexing not supported.']);
|
||||
otherwise
|
||||
error('Section Class: subsref.m impossible case')
|
||||
error('@section.subsref: impossible case')
|
||||
end
|
||||
|
||||
S = shiftS(S);
|
||||
|
|
|
@ -26,7 +26,7 @@ switch nargin
|
|||
'valid arguments are sections objects']);
|
||||
s = varargin{1};
|
||||
otherwise
|
||||
error('Sections constructor: invalid number of arguments');
|
||||
error('@sections.sections: invalid number of arguments');
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -34,6 +34,6 @@ switch S.type
|
|||
assert(isnumeric(index));
|
||||
B.objArray(index) = V;
|
||||
otherwise
|
||||
error('objArray subsasign syntax error')
|
||||
error('@sections.subsasgn: syntax error')
|
||||
end
|
||||
end
|
|
@ -31,14 +31,14 @@ switch S(1).type
|
|||
A = feval(S(1).subs, A);
|
||||
end
|
||||
otherwise
|
||||
error(['Sections Class: unknown field or method: ' S(1).subs]);
|
||||
error(['@sections.subsref unknown field or method: ' S(1).subs]);
|
||||
end
|
||||
case '()'
|
||||
A = getSections(A, S(1).subs{:});
|
||||
case '{}'
|
||||
error(['Sections Class: ' S(1).type ' indexing not supported.']);
|
||||
error(['@sections.subsref ' S(1).type ' indexing not supported.']);
|
||||
otherwise
|
||||
error('Sections Class: subsref.m impossible case')
|
||||
error('@sections.subsref subsref.m impossible case')
|
||||
end
|
||||
|
||||
S = shiftS(S);
|
||||
|
|
|
@ -34,9 +34,9 @@ switch S.type
|
|||
case fieldnames(A)
|
||||
B.(S.subs) = V;
|
||||
otherwise
|
||||
error(['field ' S.subs 'does not exist in the page class'])
|
||||
error(['@table.subsasgn: field ' S.subs 'does not exist in the table class'])
|
||||
end
|
||||
otherwise
|
||||
error('report subsasign syntax error')
|
||||
error('@table.subsasgn: syntax error')
|
||||
end
|
||||
end
|
|
@ -31,12 +31,12 @@ switch S(1).type
|
|||
A = feval(S(1).subs, A);
|
||||
end
|
||||
otherwise
|
||||
error(['Table Class: unknown field or method: ' S(1).subs]);
|
||||
error(['@table.subsref: unknown field or method: ' S(1).subs]);
|
||||
end
|
||||
case {'()', '{}'}
|
||||
error(['Table Class: ' S(1).type ' indexing not supported.']);
|
||||
error(['@table.subsref: ' S(1).type ' indexing not supported.']);
|
||||
otherwise
|
||||
error('Table Class: subsref.m impossible case')
|
||||
error('@table.subsref: subsref.m impossible case')
|
||||
end
|
||||
|
||||
S = shiftS(S);
|
||||
|
|
Loading…
Reference in New Issue