BitShares-Core  4.0.0
BitShares blockchain implementation and command-line interface software
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
fc::exception Class Reference

Used to generate a useful error report when an exception is thrown.At each level in the stack where the exception is caught and rethrown a new log_message is added to the exception. More...

#include <exception.hpp>

Inheritance diagram for fc::exception:
fc::unhandled_exception

Public Types

enum  code_enum { code_value = unspecified_exception_code }
 

Public Member Functions

 exception (int64_t code=unspecified_exception_code, const std::string &name_value="exception", const std::string &what_value="unspecified")
 
 exception (log_message &&, int64_t code=unspecified_exception_code, const std::string &name_value="exception", const std::string &what_value="unspecified")
 
 exception (log_messages &&, int64_t code=unspecified_exception_code, const std::string &name_value="exception", const std::string &what_value="unspecified")
 
 exception (const log_messages &, int64_t code=unspecified_exception_code, const std::string &name_value="exception", const std::string &what_value="unspecified")
 
 exception (const exception &e)
 
 exception (exception &&e)
 
virtual ~exception ()
 
const char * name () const throw ()
 
int64_t code () const throw ()
 
virtual const char * what () const throw ()
 
const log_messagesget_log () const
 
void append_log (log_message m)
 
std::string to_detail_string (log_level ll=log_level::all) const
 
std::string to_string (log_level ll=log_level::info) const
 
virtual void dynamic_rethrow_exception () const
 
virtual std::shared_ptr< exceptiondynamic_copy_exception () const
 
exceptionoperator= (const exception &copy)
 
exceptionoperator= (exception &&copy)
 

Protected Attributes

std::unique_ptr< detail::exception_impl > my
 

Friends

void to_variant (const exception &e, variant &v, uint32_t max_depth)
 
void from_variant (const variant &e, exception &ll, uint32_t max_depth)
 

Detailed Description

Used to generate a useful error report when an exception is thrown.

At each level in the stack where the exception is caught and rethrown a new log_message is added to the exception.

exception's are designed to be serialized to a variant and deserialized from an variant.

See also
FC_THROW_EXCEPTION
FC_RETHROW_EXCEPTION
FC_RETHROW_EXCEPTIONS

Definition at line 56 of file exception.hpp.

Member Enumeration Documentation

Enumerator
code_value 

Definition at line 59 of file exception.hpp.

Constructor & Destructor Documentation

fc::exception::exception ( int64_t  code = unspecified_exception_code,
const std::string &  name_value = "exception",
const std::string &  what_value = "unspecified" 
)

Definition at line 112 of file exception.cpp.

fc::exception::exception ( log_message &&  msg,
int64_t  code = unspecified_exception_code,
const std::string &  name_value = "exception",
const std::string &  what_value = "unspecified" 
)

Definition at line 122 of file exception.cpp.

fc::exception::exception ( log_messages &&  msgs,
int64_t  code = unspecified_exception_code,
const std::string &  name_value = "exception",
const std::string &  what_value = "unspecified" 
)

Definition at line 60 of file exception.cpp.

fc::exception::exception ( const log_messages msgs,
int64_t  code = unspecified_exception_code,
const std::string &  name_value = "exception",
const std::string &  what_value = "unspecified" 
)

Definition at line 71 of file exception.cpp.

fc::exception::exception ( const exception e)

Definition at line 133 of file exception.cpp.

fc::exception::exception ( exception &&  e)

Definition at line 136 of file exception.cpp.

fc::exception::~exception ( )
virtual

Definition at line 143 of file exception.cpp.

Member Function Documentation

void fc::exception::append_log ( log_message  m)

Definition at line 173 of file exception.cpp.

int64_t fc::exception::code ( ) const
throw (
)

Definition at line 141 of file exception.cpp.

exception_ptr fc::exception::dynamic_copy_exception ( ) const
virtual

This is equivalent to:

try { throwAsDynamic_exception(); }
catch( ... ) { return std::current_exception(); }

Reimplemented in fc::unhandled_exception.

Definition at line 267 of file exception.cpp.

void fc::exception::dynamic_rethrow_exception ( ) const
virtual

Throw this exception as its most derived type.

Note
does not return.

Rethrows the exception restoring the proper type based upon the error code. This is used to propagate exception types across conversions to/from JSON

Reimplemented in fc::unhandled_exception.

Definition at line 262 of file exception.cpp.

const log_messages & fc::exception::get_log ( ) const
Returns
a reference to log messages that have been added to this log.

Definition at line 172 of file exception.cpp.

const char * fc::exception::name ( ) const
throw (
)

Definition at line 139 of file exception.cpp.

exception & fc::exception::operator= ( const exception copy)

Definition at line 296 of file exception.cpp.

exception & fc::exception::operator= ( exception &&  copy)

Definition at line 302 of file exception.cpp.

string fc::exception::to_detail_string ( log_level  ll = log_level::all) const

Generates a detailed string including file, line, method, and other information that is generally only useful for developers.

Definition at line 183 of file exception.cpp.

string fc::exception::to_string ( log_level  ll = log_level::info) const

Generates a user-friendly error report.

Definition at line 227 of file exception.cpp.

const char * fc::exception::what ( ) const
throw (
)
virtual

Definition at line 140 of file exception.cpp.

Friends And Related Function Documentation

void from_variant ( const variant e,
exception ll,
uint32_t  max_depth 
)
friend

Definition at line 158 of file exception.cpp.

void to_variant ( const exception e,
variant v,
uint32_t  max_depth 
)
friend

Definition at line 145 of file exception.cpp.

Member Data Documentation

std::unique_ptr<detail::exception_impl> fc::exception::my
protected

Definition at line 126 of file exception.hpp.


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