OpenVPN 3 Core Library
Loading...
Searching...
No Matches
exception.hpp File Reference
#include <string>
#include <sstream>
#include <exception>
#include <utility>
#include <openvpn/common/stringize.hpp>
#include <openvpn/common/string.hpp>
Include dependency graph for exception.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  openvpn::Exception
 

Namespaces

namespace  openvpn
 

Macros

#define OPENVPN_FILE_LINE
 
#define OPENVPN_SIMPLE_EXCEPTION(C)
 
#define OPENVPN_SIMPLE_EXCEPTION_INHERIT(B, C)
 
#define OPENVPN_EXCEPTION(C)
 
#define OPENVPN_EXCEPTION_WITH_CODE(C, DEFAULT_CODE, ...)
 
#define OPENVPN_UNTAGGED_EXCEPTION(C)
 
#define OPENVPN_EXCEPTION_INHERIT(B, C)
 
#define OPENVPN_UNTAGGED_EXCEPTION_INHERIT(B, C)
 
#define OPENVPN_THROW_EXCEPTION(stuff)
 
#define OPENVPN_THROW(exc, stuff)
 
#define OPENVPN_THROW_ARG1(exc, arg, stuff)
 

Functions

void openvpn::throw_ref (const std::exception &e)
 

Macro Definition Documentation

◆ OPENVPN_EXCEPTION

#define OPENVPN_EXCEPTION (   C)
Value:
class C : public openvpn::Exception \
{ \
public: \
C() : openvpn::Exception(#C OPENVPN_FILE_LINE) \
{ \
} \
C(const std::string err) : openvpn::Exception(#C OPENVPN_FILE_LINE ": " + err) \
{ \
} \
}
#define OPENVPN_FILE_LINE
Definition exception.hpp:31

Definition at line 100 of file exception.hpp.

◆ OPENVPN_EXCEPTION_INHERIT

#define OPENVPN_EXCEPTION_INHERIT (   B,
 
)
Value:
class C : public B \
{ \
public: \
C() : B(#C OPENVPN_FILE_LINE) \
{ \
} \
C(const std::string err) : B(#C OPENVPN_FILE_LINE ": " + err) \
{ \
} \
}

Definition at line 144 of file exception.hpp.

◆ OPENVPN_EXCEPTION_WITH_CODE

#define OPENVPN_EXCEPTION_WITH_CODE (   C,
  DEFAULT_CODE,
  ... 
)
Value:
enum C##_##code : unsigned int{__VA_ARGS__}; \
class C : public openvpn::Exception \
{ \
public: \
C() : openvpn::Exception(#C OPENVPN_FILE_LINE) \
{ \
add_label(#DEFAULT_CODE); \
} \
C(const std::string &err) : openvpn::Exception(#C OPENVPN_FILE_LINE ": " + err) \
{ \
add_label(#DEFAULT_CODE); \
} \
option_error(C##_##code code, const std::string &err) \
{ \
add_label(code2string(code)); \
} \
static std::string code2string(C##_##code code); \
}

Definition at line 113 of file exception.hpp.

◆ OPENVPN_FILE_LINE

#define OPENVPN_FILE_LINE

Definition at line 31 of file exception.hpp.

◆ OPENVPN_SIMPLE_EXCEPTION

#define OPENVPN_SIMPLE_EXCEPTION (   C)
Value:
class C : public std::exception \
{ \
public: \
const char *what() const noexcept override \
{ \
return #C OPENVPN_FILE_LINE; \
} \
}

Definition at line 75 of file exception.hpp.

◆ OPENVPN_SIMPLE_EXCEPTION_INHERIT

#define OPENVPN_SIMPLE_EXCEPTION_INHERIT (   B,
 
)
Value:
class C : public B \
{ \
public: \
C() : B(#C OPENVPN_FILE_LINE) \
{ \
} \
const char *what() const noexcept override \
{ \
return #C OPENVPN_FILE_LINE; \
} \
}

Definition at line 86 of file exception.hpp.

◆ OPENVPN_THROW

#define OPENVPN_THROW (   exc,
  stuff 
)
Value:
do \
{ \
std::ostringstream _ovpn_exc; \
_ovpn_exc << stuff; \
throw exc(_ovpn_exc.str()); \
} while (0)

Definition at line 175 of file exception.hpp.

◆ OPENVPN_THROW_ARG1

#define OPENVPN_THROW_ARG1 (   exc,
  arg,
  stuff 
)
Value:
do \
{ \
std::ostringstream _ovpn_exc; \
_ovpn_exc << stuff; \
throw exc(arg, _ovpn_exc.str()); \
} while (0)

Definition at line 183 of file exception.hpp.

◆ OPENVPN_THROW_EXCEPTION

#define OPENVPN_THROW_EXCEPTION (   stuff)
Value:
do \
{ \
std::ostringstream _ovpn_exc; \
_ovpn_exc << stuff; \
throw openvpn::Exception(_ovpn_exc.str()); \
} while (0)

Definition at line 166 of file exception.hpp.

◆ OPENVPN_UNTAGGED_EXCEPTION

#define OPENVPN_UNTAGGED_EXCEPTION (   C)
Value:
class C : public openvpn::Exception \
{ \
public: \
C(const std::string err) : openvpn::Exception(err) \
{ \
} \
}

Definition at line 134 of file exception.hpp.

◆ OPENVPN_UNTAGGED_EXCEPTION_INHERIT

#define OPENVPN_UNTAGGED_EXCEPTION_INHERIT (   B,
 
)
Value:
class C : public B \
{ \
public: \
using B::B; \
}

Definition at line 158 of file exception.hpp.