Commit 18ed9daa authored by Houtan Bastani's avatar Houtan Bastani
Browse files

reporting: make errors more clear

parent 8d36cc80
...@@ -30,7 +30,7 @@ function o = write(o) ...@@ -30,7 +30,7 @@ function o = write(o)
[fid, msg] = fopen(o.filename, 'w'); [fid, msg] = fopen(o.filename, 'w');
if fid == -1 if fid == -1
error(msg); error(['@report.subsasgn: ' msg]);
end end
fprintf(fid, '%% Report Object\n'); fprintf(fid, '%% Report Object\n');
...@@ -67,6 +67,6 @@ fprintf(fid, '\\end{document}\n'); ...@@ -67,6 +67,6 @@ fprintf(fid, '\\end{document}\n');
fprintf(fid, '%% End Report Object\n'); fprintf(fid, '%% End Report Object\n');
status = fclose(fid); status = fclose(fid);
if status == -1 if status == -1
error('Error closing %s\n', o.filename); error('@report.wrie: closing %s\n', o.filename);
end end
end end
\ No newline at end of file
...@@ -32,8 +32,8 @@ if nargin == 1 ...@@ -32,8 +32,8 @@ if nargin == 1
return; return;
elseif nargin > 1 elseif nargin > 1
if round(nargin/2) ~= nargin/2 if round(nargin/2) ~= nargin/2
error(['Options to Section constructor must be supplied in name/' ... error(['@section.section: options must be supplied in name/value ' ...
'value pairs.']); 'pairs.']);
end end
optNames = lower(fieldnames(o)); optNames = lower(fieldnames(o));
...@@ -44,7 +44,7 @@ elseif nargin > 1 ...@@ -44,7 +44,7 @@ elseif nargin > 1
if any(strmatch(field, optNames, 'exact')) if any(strmatch(field, optNames, 'exact'))
o.(field) = pair{2}; o.(field) = pair{2};
else else
error('%s is not a recognized option to the Section constructor.', ... error('@section.section: %s is not a recognized option.', ...
field); field);
end end
end end
......
...@@ -34,6 +34,6 @@ switch S.type ...@@ -34,6 +34,6 @@ switch S.type
assert(isnumeric(index)); assert(isnumeric(index));
B(index) = V; B(index) = V;
otherwise otherwise
error('objArray subsasign syntax error') error('@section.subsasgn: syntax error')
end end
end end
\ No newline at end of file
...@@ -31,14 +31,14 @@ switch S(1).type ...@@ -31,14 +31,14 @@ switch S(1).type
A = feval(S(1).subs, A); A = feval(S(1).subs, A);
end end
otherwise otherwise
error(['Section Class: unknown field or method: ' S(1).subs]); error(['@section.subsref: unknown field or method: ' S(1).subs]);
end end
case '()' case '()'
A = A.elements.getElements(S(1).subs{:}); A = A.elements.getElements(S(1).subs{:});
case '{}' case '{}'
error(['Section Class: ' S(1).type ' indexing not supported.']); error(['@section.subsref: ' S(1).type ' indexing not supported.']);
otherwise otherwise
error('Section Class: subsref.m impossible case') error('@section.subsref: impossible case')
end end
S = shiftS(S); S = shiftS(S);
......
...@@ -26,7 +26,7 @@ switch nargin ...@@ -26,7 +26,7 @@ switch nargin
'valid arguments are sections objects']); 'valid arguments are sections objects']);
s = varargin{1}; s = varargin{1};
otherwise otherwise
error('Sections constructor: invalid number of arguments'); error('@sections.sections: invalid number of arguments');
end end
end end
...@@ -34,6 +34,6 @@ switch S.type ...@@ -34,6 +34,6 @@ switch S.type
assert(isnumeric(index)); assert(isnumeric(index));
B.objArray(index) = V; B.objArray(index) = V;
otherwise otherwise
error('objArray subsasign syntax error') error('@sections.subsasgn: syntax error')
end end
end end
\ No newline at end of file
...@@ -31,14 +31,14 @@ switch S(1).type ...@@ -31,14 +31,14 @@ switch S(1).type
A = feval(S(1).subs, A); A = feval(S(1).subs, A);
end end
otherwise otherwise
error(['Sections Class: unknown field or method: ' S(1).subs]); error(['@sections.subsref unknown field or method: ' S(1).subs]);
end end
case '()' case '()'
A = getSections(A, S(1).subs{:}); A = getSections(A, S(1).subs{:});
case '{}' case '{}'
error(['Sections Class: ' S(1).type ' indexing not supported.']); error(['@sections.subsref ' S(1).type ' indexing not supported.']);
otherwise otherwise
error('Sections Class: subsref.m impossible case') error('@sections.subsref subsref.m impossible case')
end end
S = shiftS(S); S = shiftS(S);
......
...@@ -34,9 +34,9 @@ switch S.type ...@@ -34,9 +34,9 @@ switch S.type
case fieldnames(A) case fieldnames(A)
B.(S.subs) = V; B.(S.subs) = V;
otherwise 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 end
otherwise otherwise
error('report subsasign syntax error') error('@table.subsasgn: syntax error')
end end
end end
\ No newline at end of file
...@@ -31,12 +31,12 @@ switch S(1).type ...@@ -31,12 +31,12 @@ switch S(1).type
A = feval(S(1).subs, A); A = feval(S(1).subs, A);
end end
otherwise otherwise
error(['Table Class: unknown field or method: ' S(1).subs]); error(['@table.subsref: unknown field or method: ' S(1).subs]);
end end
case {'()', '{}'} case {'()', '{}'}
error(['Table Class: ' S(1).type ' indexing not supported.']); error(['@table.subsref: ' S(1).type ' indexing not supported.']);
otherwise otherwise
error('Table Class: subsref.m impossible case') error('@table.subsref: subsref.m impossible case')
end end
S = shiftS(S); S = shiftS(S);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment