#pragma once #include #include // MsgException -- an exception bearing a passed explanation message class MsgException : public std::exception { public: MsgException(const std::string& msg, int code=0); int errcode() const noexcept { return _code; } const char* what() const noexcept { return _what.c_str(); }; private: std::string _msg; int _code; std::string _what; };