jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
Namespaces | Classes | Typedefs | Functions
jubatus::core::common::exception Namespace Reference

Namespaces

 detail
 

Classes

class  error_info
 
class  error_info< struct error_splitter_, void >
 
class  error_info_base
 
class  exception_thrower_base
 
struct  exception_thrower_binder_type
 
class  exception_thrower_impl
 
class  jubaexception
 
class  jubatus_exception
 
class  runtime_error
 
class  unknown_exception
 

Typedefs

typedef error_info< struct error_api_func_, std::string > error_api_func
 
typedef error_info< struct error_at_file_, std::string > error_at_file
 
typedef error_info< struct error_at_func_, std::string > error_at_func
 
typedef error_info< struct error_at_line_, int > error_at_line
 
typedef error_info< struct error_errno_, int > error_errno
 
typedef error_info< struct error_file_name_, std::string > error_file_name
 
typedef std::vector< jubatus::util::lang::shared_ptr< error_info_base > > error_info_list_t
 
typedef error_info< struct error_message_, std::string > error_message
 
typedef error_info< struct error_splitter_, void > error_splitter
 
typedef jubatus::util::lang::shared_ptr< exception_thrower_baseexception_thrower_ptr
 

Functions

template<class Exception >
const Exception & add_info (const Exception &e, jubatus::util::lang::shared_ptr< error_info_base > info)
 
exception_thrower_ptr get_current_exception ()
 
template<class Exception , class Tag , class V >
const Exception & operator<< (const Exception &e, const error_info< Tag, V > &info)
 
template<class Exception >
const Exception & operator<< (const Exception &e, jubatus::util::lang::shared_ptr< error_info_base > info)
 
template<class Exception >
const Exception & operator<< (const Exception &e, const exception_thrower_binder_type &)
 
std::string to_string (const error_errno &info)
 
template<class Tag , class V >
std::string to_string (const error_info< Tag, V > &info)
 

Typedef Documentation

typedef error_info<struct error_api_func_, std::string> jubatus::core::common::exception::error_api_func

Definition at line 58 of file exception.hpp.

typedef error_info<struct error_at_file_, std::string> jubatus::core::common::exception::error_at_file

Definition at line 38 of file exception.hpp.

typedef error_info<struct error_at_func_, std::string> jubatus::core::common::exception::error_at_func

Definition at line 39 of file exception.hpp.

typedef error_info<struct error_at_line_, int> jubatus::core::common::exception::error_at_line

Definition at line 40 of file exception.hpp.

typedef error_info<struct error_errno_, int> jubatus::core::common::exception::error_errno

Definition at line 41 of file exception.hpp.

typedef error_info<struct error_file_name_, std::string> jubatus::core::common::exception::error_file_name

Definition at line 57 of file exception.hpp.

typedef std::vector<jubatus::util::lang::shared_ptr<error_info_base> > jubatus::core::common::exception::error_info_list_t

Definition at line 88 of file exception.hpp.

typedef error_info<struct error_message_, std::string> jubatus::core::common::exception::error_message

Definition at line 59 of file exception.hpp.

typedef error_info<struct error_splitter_, void> jubatus::core::common::exception::error_splitter

Definition at line 61 of file exception.hpp.

Definition at line 83 of file exception.hpp.

Function Documentation

template<class Exception >
const Exception& jubatus::core::common::exception::add_info ( const Exception &  e,
jubatus::util::lang::shared_ptr< error_info_base info 
)
inline

Definition at line 128 of file exception.hpp.

Referenced by operator<<().

130  {
131  e.info_list_.push_back(info);
132  return e;
133 }

Here is the caller graph for this function:

exception_thrower_ptr jubatus::core::common::exception::get_current_exception ( )
inline

Definition at line 255 of file exception.hpp.

References jubatus::core::common::exception::detail::current_std_exception(), jubatus::core::common::exception::jubatus_exception::thrower(), and jubatus::core::common::exception::jubaexception< Exception >::thrower().

255  {
257 
258  try {
259  throw;
260  } catch (const std::bad_alloc& e) { // exception
262  } catch (const std::bad_cast& e) { // exception
264  } catch (const std::bad_exception& e) { // exception
266  } catch (const std::bad_typeid& e) { // exception
268  } catch (const std::domain_error& e) { // logic_error
270  } catch (const std::invalid_argument& e) { // logic_error
272  } catch (const std::length_error& e) { // logic_error
274  } catch (const std::out_of_range& e) { // logic_error
276  } catch (const std::logic_error& e) { // exception
278  } catch (const std::range_error& e) { // runtime_error
280  } catch (const std::overflow_error& e) { // runtime_error
282  } catch (const std::underflow_error& e) { // runtime_error
284  } catch (const std::ios_base::failure& e) { // exception
286  } catch (const std::runtime_error& e) { // exception
288  } catch (const jubatus_exception& e) {
289  ptr = e.thrower();
290  } catch (const std::exception& e) {
292  } catch (...) {
293  ptr = unknown_exception().thrower();
294  }
295 
296  return ptr;
297 }
jubatus::util::lang::shared_ptr< exception_thrower_base > exception_thrower_ptr
Definition: exception.hpp:83
exception_thrower_ptr current_std_exception(const Exception &e)
Definition: exception.hpp:248

Here is the call graph for this function:

template<class Exception , class Tag , class V >
const Exception& jubatus::core::common::exception::operator<< ( const Exception &  e,
const error_info< Tag, V > &  info 
)
inline

Definition at line 136 of file exception.hpp.

References add_info().

138  {
139  return add_info(
140  e,
141  jubatus::util::lang::shared_ptr<error_info_base>(
142  new error_info<Tag, V>(info)));
143 }
const Exception & add_info(const Exception &e, jubatus::util::lang::shared_ptr< error_info_base > info)
Definition: exception.hpp:128

Here is the call graph for this function:

template<class Exception >
const Exception& jubatus::core::common::exception::operator<< ( const Exception &  e,
jubatus::util::lang::shared_ptr< error_info_base info 
)
inline

Definition at line 146 of file exception.hpp.

References add_info().

148  {
149  return add_info(e, info);
150 }
const Exception & add_info(const Exception &e, jubatus::util::lang::shared_ptr< error_info_base > info)
Definition: exception.hpp:128

Here is the call graph for this function:

template<class Exception >
const Exception& jubatus::core::common::exception::operator<< ( const Exception &  e,
const exception_thrower_binder_type  
)
inline

Definition at line 211 of file exception.hpp.

213  {
214  e.bind_thrower(
215  exception_thrower_ptr(new exception_thrower_impl<Exception>(e)));
216  return e;
217 }
jubatus::util::lang::shared_ptr< exception_thrower_base > exception_thrower_ptr
Definition: exception.hpp:83
std::string jubatus::core::common::exception::to_string ( const error_errno info)
inline

Definition at line 42 of file exception.hpp.

References jubatus::core::common::exception::error_info< Tag, V >::value().

Referenced by jubatus::core::common::exception::error_info< Tag, V >::as_string().

42  {
43  char buf[1024];
44 #if defined(__linux__)
45  std::string msg(strerror_r(info.value(), buf, sizeof(buf)));
46 #elif defined(__sparcv8) || defined(__sparcv9) || defined(__APPLE__)
47  strerror_r(info.value(), buf, sizeof(buf));
48  std::string msg(buf);
49 #else
50 #error cpp_strerror_r
51 #endif
52  msg += " (" +
53  jubatus::util::lang::lexical_cast<std::string>(info.value()) + ")";
54  return msg;
55 }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Tag , class V >
std::string jubatus::core::common::exception::to_string ( const error_info< Tag, V > &  info)
inline

Definition at line 49 of file exception_info.hpp.

References jubatus::core::common::exception::error_info< Tag, V >::value().

49  {
50  return jubatus::util::lang::lexical_cast<std::string, V>(info.value());
51 }

Here is the call graph for this function: