SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
Exception.h File Reference
#include "swcdb/core/Compat.h"
#include "swcdb/core/Error.h"
#include "swcdb/core/String.h"
#include "swcdb/core/Logger.h"
#include <stdexcept>
+ Include dependency graph for Exception.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  SWC::Error::Exception
 

Namespaces

 SWC
 The SWC-DB C++ namespace 'SWC'.
 
 SWC::Error
 The SWC-DB Error C++ namespace 'SWC::Error'.
 

Macros

#define SWC_EXCEPTION(_code_, _msg_)
 
#define SWC_EXCEPTION2(_code_, _ex_, _msg_)
 
#define SWC_CURRENT_EXCEPTION(_msg_)    ::SWC::Error::Exception::make(std::current_exception(), _msg_)
 
#define SWC_THROW(_code_, _msg_)   throw SWC_EXCEPTION(_code_, _msg_)
 
#define SWC_THROWF(_code_, _fmt_, ...)    throw SWC_EXCEPTION(_code_, ::SWC::format(_fmt_, __VA_ARGS__))
 
#define SWC_THROW2F(_code_, _ex_, _fmt_, ...)    throw SWC_EXCEPTION2(_code_, _ex_, ::SWC::format(_fmt_, __VA_ARGS__))
 
#define SWC_LOG_CURRENT_EXCEPTION(_s_)
 
#define SWC_TRY(_s_, _code_)    try { _code_ } catch(...) { throw SWC_CURRENT_EXCEPTION(_s_); }
 
#define SWC_TRY_OR_LOG(_s_, _code_)    try { _code_ } catch(...) { SWC_LOG_CURRENT_EXCEPTION(_s_); }
 
#define SWC_EXPECT(_e_, _code_)
 
#define SWC_ASSERT(_e_)   SWC_EXPECT(_e_, ::SWC::Error::FAILED_EXPECTATION)
 
#define SWC_EXPECTF(_e_, _code_, _fmt_, ...)
 
#define SWC_ASSERTF(_e_, _fmt_, ...)    SWC_EXPECTF(_e_, ::SWC::Error::FAILED_EXPECTATION, _fmt_, __VA_ARGS__)
 

Macro Definition Documentation

◆ SWC_ASSERT

#define SWC_ASSERT (   _e_)    SWC_EXPECT(_e_, ::SWC::Error::FAILED_EXPECTATION)

Definition at line 165 of file Exception.h.

◆ SWC_ASSERTF

#define SWC_ASSERTF (   _e_,
  _fmt_,
  ... 
)     SWC_EXPECTF(_e_, ::SWC::Error::FAILED_EXPECTATION, _fmt_, __VA_ARGS__)

Definition at line 175 of file Exception.h.

◆ SWC_CURRENT_EXCEPTION

#define SWC_CURRENT_EXCEPTION (   _msg_)     ::SWC::Error::Exception::make(std::current_exception(), _msg_)

Definition at line 119 of file Exception.h.

◆ SWC_EXCEPTION

#define SWC_EXCEPTION (   _code_,
  _msg_ 
)
Value:
_code_, _msg_, nullptr, __LINE__, __PRETTY_FUNCTION__, __FILE__)

Definition at line 110 of file Exception.h.

◆ SWC_EXCEPTION2

#define SWC_EXCEPTION2 (   _code_,
  _ex_,
  _msg_ 
)
Value:
_code_, _msg_, &_ex_, __LINE__, __PRETTY_FUNCTION__, __FILE__)

Definition at line 114 of file Exception.h.

◆ SWC_EXPECT

#define SWC_EXPECT (   _e_,
  _code_ 
)
Value:
if (!(_e_)) { \
if (_code_ == ::SWC::Error::FAILED_EXPECTATION) \
SWC_LOG_FATAL("failed expectation: " #_e_); \
SWC_THROW(_code_, "failed expectation: " #_e_); \
}

Definition at line 158 of file Exception.h.

◆ SWC_EXPECTF

#define SWC_EXPECTF (   _e_,
  _code_,
  _fmt_,
  ... 
)
Value:
if (!(_e_)) { \
if (_code_ == ::SWC::Error::FAILED_EXPECTATION) \
SWC_LOG_FATALF(_fmt_, __VA_ARGS__); \
SWC_THROWF(_code_, _fmt_, __VA_ARGS__); \
}

Definition at line 168 of file Exception.h.

◆ SWC_LOG_CURRENT_EXCEPTION

#define SWC_LOG_CURRENT_EXCEPTION (   _s_)
Value:

Definition at line 144 of file Exception.h.

◆ SWC_THROW

#define SWC_THROW (   _code_,
  _msg_ 
)    throw SWC_EXCEPTION(_code_, _msg_)

Definition at line 134 of file Exception.h.

◆ SWC_THROW2F

#define SWC_THROW2F (   _code_,
  _ex_,
  _fmt_,
  ... 
)     throw SWC_EXCEPTION2(_code_, _ex_, ::SWC::format(_fmt_, __VA_ARGS__))

Definition at line 139 of file Exception.h.

◆ SWC_THROWF

#define SWC_THROWF (   _code_,
  _fmt_,
  ... 
)     throw SWC_EXCEPTION(_code_, ::SWC::format(_fmt_, __VA_ARGS__))

Definition at line 136 of file Exception.h.

◆ SWC_TRY

#define SWC_TRY (   _s_,
  _code_ 
)     try { _code_ } catch(...) { throw SWC_CURRENT_EXCEPTION(_s_); }

Definition at line 150 of file Exception.h.

◆ SWC_TRY_OR_LOG

#define SWC_TRY_OR_LOG (   _s_,
  _code_ 
)     try { _code_ } catch(...) { SWC_LOG_CURRENT_EXCEPTION(_s_); }

Definition at line 153 of file Exception.h.

SWC_LOG_OSTREAM
#define SWC_LOG_OSTREAM
Definition: Logger.h:44
SWC_LOG_OUT
#define SWC_LOG_OUT(pr, _code_)
Definition: Logger.h:178
SWC::Error::FAILED_EXPECTATION
@ FAILED_EXPECTATION
Definition: Error.h:43
SWC_CURRENT_EXCEPTION
#define SWC_CURRENT_EXCEPTION(_msg_)
Definition: Exception.h:119
SWC::LOG_ERROR
@ LOG_ERROR
Definition: Logger.h:32
SWC::Error::Exception
Definition: Exception.h:21