Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dóra Kocsis
dynare
Commits
18ed9daa
Commit
18ed9daa
authored
Mar 08, 2013
by
Houtan Bastani
Browse files
reporting: make errors more clear
parent
8d36cc80
Changes
29
Hide whitespace changes
Inline
Side-by-side
matlab/reports/@elements/elements.m
View file @
18ed9daa
...
...
@@ -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
(
'
E
lements
constructor
: invalid number of arguments'
);
error
(
'
@e
lements
.elements
: invalid number of arguments'
);
end
end
\ No newline at end of file
matlab/reports/@elements/subsasgn.m
View file @
18ed9daa
...
...
@@ -34,6 +34,6 @@ switch S.type
assert
(
isnumeric
(
index
));
B
.
objArray
(
index
)
=
V
;
otherwise
error
(
'
E
lements
subsasign syntax error'
)
error
(
'
@e
lements
.
subsasign
:
syntax error'
)
;
end
end
\ No newline at end of file
matlab/reports/@elements/subsref.m
View file @
18ed9daa
...
...
@@ -31,14 +31,14 @@ switch S(1).type
A
=
feval
(
S
(
1
)
.
subs
,
A
);
end
otherwise
error
([
'
E
lements
Class
: unknown field or method: '
S
(
1
)
.
subs
]);
error
([
'
@e
lements
.subsref
: unknown field or method: '
S
(
1
)
.
subs
]);
end
case
'()'
A
=
getElements
(
A
,
S
(
1
)
.
subs
{:});
case
'{}'
error
([
'
E
lements
Class
: '
S
(
1
)
.
type
' indexing not supported.'
]);
error
([
'
@e
lements
.subsref
: '
S
(
1
)
.
type
' indexing not supported.'
]);
otherwise
error
(
'
E
lements
Class:
subsref
.m
impossible case'
)
error
(
'
@e
lements
.
subsref
:
impossible case'
)
;
end
S
=
shiftS
(
S
);
...
...
matlab/reports/@graph/createGraph.m
View file @
18ed9daa
...
...
@@ -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)
...
...
matlab/reports/@graph/graph.m
View file @
18ed9daa
...
...
@@ -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
...
...
matlab/reports/@graph/subsasgn.m
View file @
18ed9daa
...
...
@@ -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
subsas
i
gn syntax error'
)
error
(
'
@graph.
subsasgn
:
syntax error'
)
;
end
end
\ No newline at end of file
matlab/reports/@graph/subsref.m
View file @
18ed9daa
...
...
@@ -31,12 +31,12 @@ switch S(1).type
A
=
feval
(
S
(
1
)
.
subs
,
A
);
end
otherwise
error
([
'
G
raph
Class
: unknown field or method: '
S
(
1
)
.
subs
]);
error
([
'
@g
raph
.subsref
: unknown field or method: '
S
(
1
)
.
subs
]);
end
case
{
'()'
,
'{}'
}
error
([
'
G
raph
Class
: '
S
(
1
)
.
type
' indexing not supported.'
]);
error
([
'
@g
raph
.subsref
: '
S
(
1
)
.
type
' indexing not supported.'
]);
otherwise
error
(
'
G
raph
Class:
subsref
.m
impossible case'
)
error
(
'
@g
raph
.
subsref
:
impossible case'
)
end
S
=
shiftS
(
S
);
...
...
matlab/reports/@objArray/getObjs.m
View file @
18ed9daa
...
...
@@ -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
\ No newline at end of file
matlab/reports/@objArray/objArray.m
View file @
18ed9daa
...
...
@@ -34,10 +34,10 @@ switch nargin
oa
.
objs
=
cell
(
0
);
oa
=
class
(
oa
,
'objArray'
);
case
1
assert
(
isa
(
varargin
{
1
},
'objArray'
),
[
'
O
bjArray
constructor
: the only '
...
assert
(
isa
(
varargin
{
1
},
'objArray'
),
[
'
@o
bjArray
.objArray
: the only '
...
'valid arguments are objArray objects'
]);
oa
=
varargin
{
1
};
otherwise
error
(
'
O
bjArray
constructor
: invalid number of arguments'
);
error
(
'
@o
bjArray
.objArray
: invalid number of arguments'
);
end
end
\ No newline at end of file
matlab/reports/@objArray/subsasgn.m
View file @
18ed9daa
...
...
@@ -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
\ No newline at end of file
matlab/reports/@objArray/subsref.m
View file @
18ed9daa
...
...
@@ -31,14 +31,14 @@ switch S(1).type
A
=
feval
(
S
(
1
)
.
subs
,
A
);
end
otherwise
error
([
'
O
bjArray
Class
: unknown field or method: '
S
(
1
)
.
subs
]);
error
([
'
o
bjArray
.subsref
: unknown field or method: '
S
(
1
)
.
subs
]);
end
case
'()'
A
=
getObjs
(
A
,
S
(
1
)
.
subs
{:});
case
'{}'
error
([
'
O
bjArray
Class
: '
S
(
1
)
.
type
' indexing not supported.'
]);
error
([
'
o
bjArray
.subsref
: '
S
(
1
)
.
type
' indexing not supported.'
]);
otherwise
error
(
'
O
bjArray
Class:
subsref
.m
impossible case'
)
error
(
'
o
bjArray
.
subsref
:
impossible case'
)
end
S
=
shiftS
(
S
);
...
...
matlab/reports/@page/page.m
View file @
18ed9daa
...
...
@@ -37,13 +37,13 @@ o.footnote = '';
o
.
sections
=
sections
();
if
nargin
==
1
assert
(
isa
(
varargin
{
1
},
'page'
),
[
'
W
ith one arg to Page
constructor,
'
...
'you must pass a page object'
]);
assert
(
isa
(
varargin
{
1
},
'page'
),
[
'
@page.page: w
ith 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
...
...
matlab/reports/@page/subsasgn.m
View file @
18ed9daa
...
...
@@ -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
subsas
i
gn syntax error'
)
error
(
'
@page.
subsasgn
:
syntax error'
)
;
end
end
\ No newline at end of file
matlab/reports/@page/subsref.m
View file @
18ed9daa
...
...
@@ -31,14 +31,14 @@ switch S(1).type
A
=
feval
(
S
(
1
)
.
subs
,
A
);
end
otherwise
error
([
'
P
age
Class
: unknown field or method: '
S
(
1
)
.
subs
]);
error
([
'
@p
age
.subsref
: unknown field or method: '
S
(
1
)
.
subs
]);
end
case
'()'
A
=
getSections
(
A
,
S
(
1
)
.
subs
{:});
case
'{}'
error
([
'
P
age
Class
: '
S
(
1
)
.
type
' indexing not supported.'
]);
error
([
'
@p
age
.subsref
: '
S
(
1
)
.
type
' indexing not supported.'
]);
otherwise
error
(
'
P
age
Class:
subsref
.m
impossible case'
)
error
(
'
@p
age
.
subsref
:
impossible case'
)
end
S
=
shiftS
(
S
);
...
...
matlab/reports/@pages/pages.m
View file @
18ed9daa
...
...
@@ -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
(
'
P
ages
constructor
: invalid number of arguments'
);
error
(
'
@p
ages
.pages
: invalid number of arguments'
);
end
end
\ No newline at end of file
matlab/reports/@pages/subsasgn.m
View file @
18ed9daa
...
...
@@ -34,6 +34,6 @@ switch S.type
assert
(
isnumeric
(
index
));
B
.
objArray
(
index
)
=
V
;
otherwise
error
(
'
P
ages
subsas
i
gn syntax error'
);
error
(
'
@p
ages
.
subsasgn
:
syntax error'
);
end
end
\ No newline at end of file
matlab/reports/@pages/subsref.m
View file @
18ed9daa
...
...
@@ -31,14 +31,14 @@ switch S(1).type
A
=
feval
(
S
(
1
)
.
subs
,
A
);
end
otherwise
error
([
'
P
ages
Class
: unknown field or method: '
S
(
1
)
.
subs
]);
error
([
'
@p
ages
.subsref
: unknown field or method: '
S
(
1
)
.
subs
]);
end
case
'()'
A
=
getPages
(
A
,
S
(
1
)
.
subs
{:});
case
'{}'
error
([
'
P
ages
Class
: '
S
(
1
)
.
type
' indexing not supported.'
]);
error
([
'
@p
ages
.subsref
: '
S
(
1
)
.
type
' indexing not supported.'
]);
otherwise
error
(
'
P
ages
Class:
subsref
.m
impossible case'
)
error
(
'
@p
ages
.
subsref
:
impossible case'
)
end
S
=
shiftS
(
S
);
...
...
matlab/reports/@report/report.m
View file @
18ed9daa
...
...
@@ -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
...
...
matlab/reports/@report/subsasgn.m
View file @
18ed9daa
...
...
@@ -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
subsas
i
gn syntax error'
);
error
(
'
@
report
.
subsasgn
:
syntax error'
);
end
end
\ No newline at end of file
matlab/reports/@report/subsref.m
View file @
18ed9daa
...
...
@@ -31,14 +31,14 @@ switch S(1).type
A
=
feval
(
S
(
1
)
.
subs
,
A
);
end
otherwise
error
([
'
R
eport
Class
: unknown field or method: '
S
(
1
)
.
subs
]);
error
([
'
@r
eport
.subsasgn
: unknown field or method: '
S
(
1
)
.
subs
]);
end
case
'()'
A
=
A
.
pages
.
getPages
(
S
(
1
)
.
subs
{:});
case
'{}'
error
([
'
R
eport
Class
: '
S
(
1
)
.
type
' indexing not supported.'
]);
error
([
'
@r
eport
.subsasgn
: '
S
(
1
)
.
type
' indexing not supported.'
]);
otherwise
error
(
'
R
eport
Class: subsref.m
impossible case'
);
error
(
'
@r
eport
.subsasgn:
impossible case'
);
end
S
=
shiftS
(
S
);
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment