Coolquest, Inc. Home Products Support About Contact
cbold_logo_gif C++BOLD Reference Manual cbold_logo_gif

<<< Previous CBOLD Reference Home Next >>>

 

12.1. BEGERR/ENDERR

BEGERR and ENDERR are macros for error reporting. They throw an exception that is caught in main(). The exception-handling code in main() displays the message contained in the exception. The error is fatal.

The macros are used throughout the CBOLD framework source code but are also available to user code. The macros are used as follows:

if ( AnError )
  BEGERR << ErrorMessage << ENDERR;

No other code is necessary. If AnError is true, an exception object containing ErrorMessage will be created and then thrown. Execution will be transferred to the exception handler (catch statement) in main().

ErrorMessage can be any sequence of stream-style operations, for example:

if ( i > 10 )
  BEGERR << "Illegal value of variable i detected. i = " << i << ENDERR;

For example, if i were 17, then a message like the following would appear at the console:

Illegal value of variable i detected. i = 17.

If the CBOLD framework has additional information about where the error was detected, it will add that information to the message.

 

<<< Previous CBOLD Reference Home Next >>>

Legal Copyright © 2007 by Coolquest, Inc. Contact