BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet 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. 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

◆ code_enum

Enumerator
code_value 

Definition at line 59 of file exception.hpp.

Constructor & Destructor Documentation

◆ exception() [1/6]

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.

◆ exception() [2/6]

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.

◆ exception() [3/6]

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.

◆ exception() [4/6]

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.

◆ exception() [5/6]

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

Definition at line 133 of file exception.cpp.

◆ exception() [6/6]

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

Definition at line 136 of file exception.cpp.

◆ ~exception()

fc::exception::~exception ( )
virtual

Definition at line 143 of file exception.cpp.

Member Function Documentation

◆ append_log()

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

Definition at line 173 of file exception.cpp.

◆ code()

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

Definition at line 141 of file exception.cpp.

◆ dynamic_copy_exception()

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.

◆ dynamic_rethrow_exception()

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.

◆ get_log()

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.

◆ name()

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

Definition at line 139 of file exception.cpp.

◆ operator=() [1/2]

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

Definition at line 296 of file exception.cpp.

◆ operator=() [2/2]

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

Definition at line 302 of file exception.cpp.

◆ to_detail_string()

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.

◆ to_string()

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.

◆ what()

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

Definition at line 140 of file exception.cpp.

Friends And Related Function Documentation

◆ from_variant

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

Definition at line 158 of file exception.cpp.

◆ to_variant

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

Definition at line 145 of file exception.cpp.

Member Data Documentation

◆ my

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: