next up previous contents
Next: 7.4 Convenience function Up: 7. The VError class Previous: 7.2 Projection functions   Contents

7.3 Computing with VError

Two member functions let you append elements to an error:

VError &app( const char *txt );
VError &app( const int i );

For example:

VError wombat;
int n = 12;

wombat.app( "possum: no more than " ).
	app( n ).app( " elements\n" );
throw( wombat );

will throw a VError with a diagnostic of:

possum: no more than 12 elements

The member function perror() prints the error message to stdout and exits with a code of 1.

void perror( const char * );
void perror();



John Cupitt 2005-04-11