Skip to content
Snippets Groups Projects
Commit a012e8fd authored by g0dil's avatar g0dil
Browse files

Add method argument to SystemException

parent 05901d62
No related branches found
No related tags found
No related merge requests found
......@@ -27,14 +27,24 @@
// 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////////////////////////////////////////
......
......@@ -25,6 +25,7 @@
// Custom includes
#include <exception>
#include <string>
//#include "Exception.mpp"
///////////////////////////////hh.p////////////////////////////////////////
......@@ -34,9 +35,18 @@ namespace lib {
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_;
};
}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment