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.
Blah.
Return to top of page or to the FAQ.