congestvpn/util.hpp

18 lines
451 B
C++

#pragma once
#include <exception>
#include <string>
// 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;
};