Download

Feel free to browse the distribution directory for tar.gz files for "released" versions -- or take a look at the source trees themselves for different versions.

Version v1 is a simple Error class and test program. This error object has an integer for an error code and a string for an error message.

Version v2implements an ErrorMessage class that uses a std::stringstream to hold a text message and overloads operator<< so that the object may be output directly without calling individual methods (ie: code()/what()).

Version v3 implements a CodedErrorMessage via a template and allows for appending to the text via operator<<. For example:

  CodedErrorMessage cem(1, "error 1 with this text...");
  cem << "more";
  std::cout << cem;

Version v4 has a very simple exception class that uses multiple inheritance to extend std::exception *and* also the previous ErrorMessage class (ie: v3). The CodedErrorMessage is not used in this version.

Version v5 has a very simple exception class that uses multiple inheritance to extend std::exception *and* also the previous ErrorMessage class. The CodedErrorMessage is not used in this version. This coded also uses an enum for an error code as an example. However, there was an issue trying to use a const char* from a temporary in this code, so this code holds the type in the TypedException object and the message in the Exception object. This code is just here for later reference. Note: DO NOT USE THIS CODE

Version v6 is another version, playing and planning a refactoring.

Version v7 is a refactored version. Now TypedException inherits from both std::exception and TypedErrorMessage. TypedErrorMessage holds a type object that may be retrieved via .code() and the message itself may be retrieved via .what() (which returns a const char*) as is standard with exceptions.