24class Exception :
public std::exception {
27 const std::string& msg = std::string(),
28 const std::string& name = std::string(),
29 const std::string& scope = std::string(),
30 unsigned int code = 0,
31 const std::string& description = std::string()
33 : _msg(msg), _name(name), _scope(scope), _code(code), _description(description) {
35 if (!_description.empty()) {
36 _what +=
" | " + _description;
39 virtual const char* what()
const noexcept override {
return _what.c_str(); }
40 std::string getName()
const noexcept;
41 std::string getScope()
const noexcept;
42 unsigned int getCode()
const noexcept;
43 std::string getDescription()
const noexcept;
44 std::string getFull(
bool JSON =
false)
const noexcept;
45 virtual void rethrow()
const;
47 void setCause(
const Exception& cause);
48 std::shared_ptr<Exception> getCause()
const noexcept {
return _cause; }
55 std::string _description;
57 std::shared_ptr<Exception> _cause;