Mercurial > hg > octave-nkf
comparison libinterp/octave-value/ov-struct.cc @ 15731:18f168880226
error_ids: Adding ids and documentation
error_ids.m: Added ID Octave:bad-alloc and Octave:undefined-function
error.txi: Added section that explains how to catch errors with ids
for this I needed a working example. I chose the ID
Octave:invalid-indexing.
ov-struct.cc: When a structure is indexed with a field it doesn't have
the error now returns the corresponding ID
Octave:invalid-indexing.
author | Juan Pablo Carbajal <ajuanpi+dev@gmail.com> |
---|---|
date | Tue, 04 Dec 2012 20:06:49 +0100 |
parents | f2b8f90052fd |
children | c33594eefda7 |
comparison
equal
deleted
inserted
replaced
15730:84d29b282130 | 15731:18f168880226 |
---|---|
83 if (p != map.end ()) | 83 if (p != map.end ()) |
84 retval = map.contents (p); | 84 retval = map.contents (p); |
85 else if (auto_add) | 85 else if (auto_add) |
86 retval = (numel () == 0) ? Cell (dim_vector (1, 1)) : Cell (dims ()); | 86 retval = (numel () == 0) ? Cell (dim_vector (1, 1)) : Cell (dims ()); |
87 else | 87 else |
88 error ("structure has no member '%s'", nm.c_str ()); | 88 error_with_id ("Octave:invalid-indexing", |
89 "structure has no member '%s'", nm.c_str ()); | |
89 | 90 |
90 return retval; | 91 return retval; |
91 } | 92 } |
92 | 93 |
93 #if 0 | 94 #if 0 |
1141 return retval; | 1142 return retval; |
1142 | 1143 |
1143 retval = map.getfield (nm); | 1144 retval = map.getfield (nm); |
1144 | 1145 |
1145 if (! auto_add && retval.is_undefined ()) | 1146 if (! auto_add && retval.is_undefined ()) |
1146 error ("structure has no member '%s'", nm.c_str ()); | 1147 error_with_id ("Octave:invalid-indexing", |
1148 "structure has no member '%s'", nm.c_str ()); | |
1147 | 1149 |
1148 return retval; | 1150 return retval; |
1149 } | 1151 } |
1150 | 1152 |
1151 octave_value | 1153 octave_value |