//! See discussion in Saylan, G., "Practical C++ error handling in hybrid environments," Dr. Dobb's Journal, p. 50-55, March 2007.
//! He uses an auto_ptr to track a stringstream. It constructs a string on the fly. RoadError uses the copy constructor to transform RoadLogEvent into a string
classRoadError;
classRoadError:publicstd::exception{
private:
#//Fields
interror_code;//! Non-zero code (not logged), maybe returned as program status
RoadLogEventlog_event;//! Format string w/ arguments
mutablestd::stringerror_message;//! Formated error message. Must be after log_event.
#//Class fields
staticconstchar*ROADtag;
staticstd::ostringstreamglobal_log;//! May be replaced with any ostream object
public:
#//Constants
#//Constructors
RoadError();
RoadError(constRoadError&e);//! Called on throw, generates error_message