git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@147
270642c3-0616-0410-b53a-bc976706d245
// Custom includes
#include <cstring>
+#include <sstream>
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
+prefix_ void satcom::lib::SystemException::init()
+{
+ std::stringstream s;
+ if (where)
+ s << where << ": ";
+ s << "(" << err << ") " << std::strerror(err);
+ buffer_ = s.str();
+}
+
prefix_ char const * satcom::lib::SystemException::what()
const throw()
{
- return std::strerror(this->err);
+ return buffer_.c_str();
}
///////////////////////////////cc.e////////////////////////////////////////
// Custom includes
#include <exception>
+#include <string>
//#include "Exception.mpp"
///////////////////////////////hh.p////////////////////////////////////////
struct SystemException : public std::exception
{
- SystemException(int err_) : err(err_) {};
+ explicit SystemException(int err_) : where(0), err(err_) { init(); }
+ SystemException(char const * where_, int err_) : where(where_), err(err_) { init(); }
+
virtual char const * what() const throw();
+
+ char const * where;
int err;
+
+ virtual ~SystemException() throw() {}
+ private:
+ void init();
+ std::string buffer_;
};
}}