icedb  version 0.5.1
Snow particle scattering database API
Public Member Functions | Protected Attributes | List of all members
icedb::error::xError Class Reference

#include <error.hpp>

Inheritance diagram for icedb::error::xError:
Inheritance graph
[legend]
Collaboration diagram for icedb::error::xError:
Collaboration graph
[legend]

Public Member Functions

 xError (error_types=error_types::xOtherError)
 
virtual ~xError ()
 
virtual const char * what () const noexcept
 
xErrorpush (::icedb::registry::options_ptr)
 Insert a context of Errors. More...
 
xErrorpush ()
 
template<class T >
xErroradd (const std::string &key, const T value)
 
template<>
DL_ICEDB xErroradd (const std::string &key, char const *const value)
 

Protected Attributes

std::shared_ptr< error_options_innerep
 

Detailed Description

xError is the base class for icedb C++ exceptions. C code should use the C interface.

Definition at line 17 of file error.hpp.

Constructor & Destructor Documentation

◆ xError()

icedb::error::xError::xError ( error::error_types  xe = error_types::xOtherError)

Definition at line 237 of file error.cpp.

237  {
238  ep = std::shared_ptr<error_options_inner>(new error_options_inner);
239  ep->et = xe;
240  }
std::shared_ptr< error_options_inner > ep
Definition: error.hpp:20

◆ ~xError()

icedb::error::xError::~xError ( )
virtual

Definition at line 241 of file error.cpp.

241 {}

Member Function Documentation

◆ add() [1/2]

template<class T >
xError & icedb::error::xError::add ( const std::string &  key,
const T  value 
)

Definition at line 271 of file error.cpp.

Referenced by icedb::Examples::Shapes::readDataset().

272  {
273  if (!ep->cur) push();
274  this->ep->cur->add<T>(key, value);
275  return *this;
276  }
std::shared_ptr< error_options_inner > ep
Definition: error.hpp:20
xError & push()
Definition: error.cpp:263
Here is the caller graph for this function:

◆ add() [2/2]

template<>
DL_ICEDB xError& icedb::error::xError::add ( const std::string &  key,
char const *const  value 
)

Definition at line 284 of file error.cpp.

285  {
286  if (!ep->cur) push();
287  this->ep->cur->add<std::string>(key, std::string(value));
288  return *this;
289  }
std::shared_ptr< error_options_inner > ep
Definition: error.hpp:20
xError & push()
Definition: error.cpp:263

◆ push() [1/2]

xError & icedb::error::xError::push ( ::icedb::registry::options_ptr  op)

Insert a context of Errors.

Definition at line 257 of file error.cpp.

258  {
259  ep->stk.push_back(op);
260  ep->cur = op;
261  return *this;
262  }
std::shared_ptr< error_options_inner > ep
Definition: error.hpp:20

◆ push() [2/2]

xError & icedb::error::xError::push ( )

Definition at line 263 of file error.cpp.

References icedb::registry::options::generate().

264  {
266  ep->stk.push_back(op);
267  ep->cur = op;
268  return *this;
269  }
static std::shared_ptr< options > generate()
Definition: options.cpp:18
std::shared_ptr< error_options_inner > ep
Definition: error.hpp:20
std::shared_ptr< options > options_ptr
Here is the call graph for this function:

◆ what()

const char * icedb::error::xError::what ( ) const
virtualnoexcept

Definition at line 242 of file error.cpp.

References icedb::error::stringify().

242  {
243  //static const char* msg = "An unknown error has occurred.";
244  //return msg;
245  std::ostringstream o;
246  o << "error: " << stringify(ep->et) << std::endl;
247  // Pull from stack
248  int i = 1;
249  for (const auto &e : ep->stk) {
250  o << "Throw frame " << i << std::endl;
251  e->enumVals(o);
252  ++i;
253  }
254  ep->emessage = o.str();
255  return ep->emessage.c_str();
256  }
DL_ICEDB void stringify(error_code_t err, std::string &res)
Definition: error.cpp:307
std::shared_ptr< error_options_inner > ep
Definition: error.hpp:20
Here is the call graph for this function:

Member Data Documentation

◆ ep

std::shared_ptr<error_options_inner> icedb::error::xError::ep
protected

Definition at line 20 of file error.hpp.


The documentation for this class was generated from the following files: