comparison doc/interpreter/errors.txi @ 15524:15628a84a4fa stable

Document form of warning IDs is NAMESPACE:WARNING-NAME (bug #37559) * errors.txi: Add explanation of warning ID form to documentation. Correct example code to properly use warning IDs. * error.cc (Fwarning): Document form of warning ID in warning() docstring.
author Rik <rik@octave.org>
date Mon, 15 Oct 2012 07:18:31 -0700
parents 72c96de7a403
children ae43fc2ddcac 6a4e79110857
comparison
equal deleted inserted replaced
15522:7f7a07657be4 15524:15628a84a4fa
294 294
295 It is also possible to assign an identification string to a warning. 295 It is also possible to assign an identification string to a warning.
296 If a warning has such an ID the user can enable and disable this warning 296 If a warning has such an ID the user can enable and disable this warning
297 as will be described in the next section. To assign an ID to a warning, 297 as will be described in the next section. To assign an ID to a warning,
298 simply call @code{warning} with two string arguments, where the first 298 simply call @code{warning} with two string arguments, where the first
299 is the identification string, and the second is the actual warning. 299 is the identification string, and the second is the actual warning. Note
300 that warning IDs are in the format "NAMESPACE:WARNING-NAME". The namespace
301 "Octave" is used for Octave's own warnings. Any other string is available
302 as a namespace for user's own warnings.
300 303
301 @DOCSTRING(warning) 304 @DOCSTRING(warning)
302 305
303 @DOCSTRING(lastwarn) 306 @DOCSTRING(lastwarn)
304 307
313 It is also possible to enable and disable individual warnings through 316 It is also possible to enable and disable individual warnings through
314 their string identifications. The following code will issue a warning 317 their string identifications. The following code will issue a warning
315 318
316 @example 319 @example
317 @group 320 @group
318 warning ("non-negative-variable", 321 warning ("example:non-negative-variable",
319 "'a' must be non-negative. Setting 'a' to zero."); 322 "'a' must be non-negative. Setting 'a' to zero.");
320 @end group 323 @end group
321 @end example 324 @end example
322 325
323 @noindent 326 @noindent
324 while the following won't issue a warning 327 while the following won't issue a warning
325 328
326 @example 329 @example
327 @group 330 @group
328 warning ("off", "non-negative-variable"); 331 warning ("off", "example:non-negative-variable");
329 warning ("non-negative-variable", 332 warning ("example:non-negative-variable",
330 "'a' must be non-negative. Setting 'a' to zero."); 333 "'a' must be non-negative. Setting 'a' to zero.");
331 @end group 334 @end group
332 @end example 335 @end example
333 336
334 The functions distributed with Octave can issue one of the following 337 The functions distributed with Octave can issue one of the following