Chapter 19 deals with program diagnostics, such as exceptions and assertions.
The standard exception classes carry with them a single string as data (usually describing what went wrong or where the 'throw' took place). It's good to remember that you can add your own data to these exceptions when extending the heirarchy:
using std::runtime_error; struct My_Exception : public runtime_error { public: My_Exception (const string& whatarg) : runtime_error(whatarg), e(errno), id(GetDataBaseID()) { } int errno_at_time_of_throw() const { return e; } DBID id_of_thing_that_threw() const { return id; } protected: int e; DBID id; // some user-defined type };
Return to top of page or to the FAQ.
The diagram is in PDF, or at least it will be once it gets finished.
Return to top of page or to the FAQ.
Comments and suggestions are welcome, and may be sent to
Phil Edwards or
Gabriel Dos Reis.
$Id: howto.html,v 1.4 1999/12/15 16:57:06 pme Exp $