Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
exception.hpp File Reference

Defines exception's used by fc.

#include <fc/log/logger.hpp>
#include <exception>
#include <functional>
#include <unordered_map>
#include <boost/core/typeinfo.hpp>
#include <boost/interprocess/exceptions.hpp>
Include dependency graph for exception.hpp:

Go to the source code of this file.

Classes

class  fc::exception
 Used to generate a useful error report when an exception is thrown. More...
 
class  fc::unhandled_exception
 re-thrown whenever an unhandled exception is caught.Any exceptions thrown by 3rd party libraries that are not caught get wrapped in an unhandled_exception exception. More...
 
class  fc::std_exception_wrapper
 wrapper for std::exception More...
 
class  fc::exception_factory
 
struct  fc::exception_factory::base_exception_builder
 
struct  fc::exception_factory::exception_builder< T >
 

Namespaces

namespace  fc
 namespace sysio::chain
 
namespace  fc::detail
 

Macros

#define FC_REGISTER_EXCEPTION(r, unused, base)
 
#define FC_REGISTER_EXCEPTIONS(SEQ)
 
#define FC_DECLARE_DERIVED_EXCEPTION(TYPE, BASE, CODE, WHAT)
 
#define FC_DECLARE_EXCEPTION(TYPE, CODE, WHAT)
 
#define LIKELY(x)
 
#define UNLIKELY(x)
 
#define FC_EXPAND_MACRO(x)
 : Workaround for varying preprocessing behavior between MSVC and gcc
 
#define FC_ASSERT(TEST, ...)
 Checks a condition and throws an assert_exception if the test is FALSE.
 
#define FC_CAPTURE_AND_THROW(EXCEPTION_TYPE, ...)
 
#define FC_INDIRECT_EXPAND(MACRO, ARGS)
 
#define FC_THROW( ...)
 
#define FC_EXCEPTION(EXCEPTION_TYPE, FORMAT, ...)
 
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT, ...)
 
#define FC_RETHROW_EXCEPTION(ER, LOG_LEVEL, FORMAT, ...)
 Appends a log_message to the exception ER and rethrows it.
 
#define FC_LOG_AND_RETHROW()
 
#define FC_CAPTURE_LOG_AND_RETHROW(...)
 
#define FC_CAPTURE_AND_LOG(...)
 
#define FC_LOG_AND_DROP(...)
 
#define FC_RETHROW_EXCEPTIONS(LOG_LEVEL, FORMAT, ...)
 Catchs all exception's, std::exceptions, and ... and rethrows them after appending the provided log message.
 
#define FC_CAPTURE_AND_RETHROW(...)
 
#define FC_CHECK_DEADLINE(DEADLINE, ...)
 

Typedefs

typedef std::shared_ptr< exceptionfc::exception_ptr
 
typedef std::optional< exceptionfc::oexception
 

Enumerations

enum  fc::exception_code {
  fc::unspecified_exception_code = 0 , fc::unhandled_exception_code = 1 , fc::timeout_exception_code = 2 , fc::file_not_found_exception_code = 3 ,
  fc::parse_error_exception_code = 4 , fc::invalid_arg_exception_code = 5 , fc::key_not_found_exception_code = 6 , fc::bad_cast_exception_code = 7 ,
  fc::out_of_range_exception_code = 8 , fc::canceled_exception_code = 9 , fc::assert_exception_code = 10 , fc::eof_exception_code = 11 ,
  fc::std_exception_code = 13 , fc::invalid_operation_exception_code = 14 , fc::unknown_host_exception_code = 15 , fc::null_optional_code = 16 ,
  fc::udt_error_code = 17 , fc::aes_error_code = 18 , fc::overflow_code = 19 , fc::underflow_code = 20 ,
  fc::divide_by_zero_code = 21
}
 

Functions

void fc::to_variant (const exception &e, variant &v)
 
void fc::from_variant (const variant &e, exception &ll)
 
template<typename T >
fc::exception_ptr fc::copy_exception (T &&e)
 
 fc::FC_DECLARE_EXCEPTION (timeout_exception, timeout_exception_code, "Timeout")
 
 fc::FC_DECLARE_EXCEPTION (file_not_found_exception, file_not_found_exception_code, "File Not Found")
 
 fc::FC_DECLARE_EXCEPTION (parse_error_exception, parse_error_exception_code, "Parse Error")
 report's parse errors
 
 fc::FC_DECLARE_EXCEPTION (invalid_arg_exception, invalid_arg_exception_code, "Invalid Argument")
 
 fc::FC_DECLARE_EXCEPTION (key_not_found_exception, key_not_found_exception_code, "Key Not Found")
 reports when a key, guid, or other item is not found.
 
 fc::FC_DECLARE_EXCEPTION (bad_cast_exception, bad_cast_exception_code, "Bad Cast")
 
 fc::FC_DECLARE_EXCEPTION (out_of_range_exception, out_of_range_exception_code, "Out of Range")
 
 fc::FC_DECLARE_EXCEPTION (invalid_operation_exception, invalid_operation_exception_code, "Invalid Operation")
 if an operation is unsupported or not valid this may be thrown
 
 fc::FC_DECLARE_EXCEPTION (unknown_host_exception, unknown_host_exception_code, "Unknown Host")
 if an host name can not be resolved this may be thrown
 
 fc::FC_DECLARE_EXCEPTION (canceled_exception, canceled_exception_code, "Canceled")
 used to report a canceled Operation
 
 fc::FC_DECLARE_EXCEPTION (assert_exception, assert_exception_code, "Assert Exception")
 used inplace of assert() to report violations of pre conditions.
 
 fc::FC_DECLARE_EXCEPTION (eof_exception, eof_exception_code, "End Of File")
 
 fc::FC_DECLARE_EXCEPTION (null_optional, null_optional_code, "null optional")
 
 fc::FC_DECLARE_EXCEPTION (udt_exception, udt_error_code, "UDT error")
 
 fc::FC_DECLARE_EXCEPTION (aes_exception, aes_error_code, "AES error")
 
 fc::FC_DECLARE_EXCEPTION (overflow_exception, overflow_code, "Integer Overflow")
 
 fc::FC_DECLARE_EXCEPTION (underflow_exception, underflow_code, "Integer Underflow")
 
 fc::FC_DECLARE_EXCEPTION (divide_by_zero_exception, divide_by_zero_code, "Integer Divide By Zero")
 
std::string fc::except_str ()
 
void fc::record_assert_trip (const char *filename, uint32_t lineno, const char *expr)
 

Variables

bool fc::enable_record_assert_trip = false
 

Macro Definition Documentation

◆ FC_ASSERT

#define FC_ASSERT ( TEST,
... )
Value:
if( UNLIKELY(!(TEST)) ) \
{ \
fc::record_assert_trip( __FILE__, __LINE__, #TEST ); \
FC_THROW_EXCEPTION( fc::assert_exception, #TEST ": " __VA_ARGS__ ); \
} \
)
#define UNLIKELY(x)
#define FC_EXPAND_MACRO(x)
: Workaround for varying preprocessing behavior between MSVC and gcc
#define TEST(test_case_name, test_name)
Definition gtest.h:2275
#define FC_MULTILINE_MACRO_END
Definition logger.hpp:74
#define FC_MULTILINE_MACRO_BEGIN
Definition logger.hpp:66
bool enable_record_assert_trip

Definition at line 362 of file exception.hpp.

362#define FC_ASSERT( TEST, ... ) \
363 FC_EXPAND_MACRO( \
364 FC_MULTILINE_MACRO_BEGIN \
365 if( UNLIKELY(!(TEST)) ) \
366 { \
367 if( fc::enable_record_assert_trip ) \
368 fc::record_assert_trip( __FILE__, __LINE__, #TEST ); \
369 FC_THROW_EXCEPTION( fc::assert_exception, #TEST ": " __VA_ARGS__ ); \
370 } \
371 FC_MULTILINE_MACRO_END \
372 )

◆ FC_CAPTURE_AND_LOG

#define FC_CAPTURE_AND_LOG ( ...)
Value:
catch( const boost::interprocess::bad_alloc& ) {\
throw;\
} catch( fc::exception& er ) { \
wlog( "${details}", ("details",er.to_detail_string()) ); \
wdump( __VA_ARGS__ ); \
} catch( const std::exception& e ) { \
FC_LOG_MESSAGE( warn, "rethrow ${what}: ",FC_FORMAT_ARG_PARAMS( __VA_ARGS__ )("what",e.what()) ), \
std::current_exception(), \
BOOST_CORE_TYPEID(e).name(), \
e.what() ) ; \
wlog( "${details}", ("details",sew.to_detail_string()) ); \
wdump( __VA_ARGS__ ); \
} catch( ... ) { \
FC_LOG_MESSAGE( warn, "rethrow", FC_FORMAT_ARG_PARAMS( __VA_ARGS__) ), \
std::current_exception() ); \
wlog( "${details}", ("details",e.to_detail_string()) ); \
wdump( __VA_ARGS__ ); \
}
std::string name
Used to generate a useful error report when an exception is thrown.
Definition exception.hpp:58
std::string to_detail_string(log_level ll=log_level::all) const
wrapper for std::exception
re-thrown whenever an unhandled exception is caught.Any exceptions thrown by 3rd party libraries that...
#define FC_LOG_MESSAGE(LOG_LEVEL, FORMAT,...)
A helper method for generating log messages.
#define FC_FORMAT_ARG_PARAMS(...)
Definition logger.hpp:155

Definition at line 458 of file exception.hpp.

458#define FC_CAPTURE_AND_LOG( ... ) \
459 catch( const boost::interprocess::bad_alloc& ) {\
460 throw;\
461 } catch( fc::exception& er ) { \
462 wlog( "${details}", ("details",er.to_detail_string()) ); \
463 wdump( __VA_ARGS__ ); \
464 } catch( const std::exception& e ) { \
465 fc::std_exception_wrapper sew( \
466 FC_LOG_MESSAGE( warn, "rethrow ${what}: ",FC_FORMAT_ARG_PARAMS( __VA_ARGS__ )("what",e.what()) ), \
467 std::current_exception(), \
468 BOOST_CORE_TYPEID(e).name(), \
469 e.what() ) ; \
470 wlog( "${details}", ("details",sew.to_detail_string()) ); \
471 wdump( __VA_ARGS__ ); \
472 } catch( ... ) { \
473 fc::unhandled_exception e( \
474 FC_LOG_MESSAGE( warn, "rethrow", FC_FORMAT_ARG_PARAMS( __VA_ARGS__) ), \
475 std::current_exception() ); \
476 wlog( "${details}", ("details",e.to_detail_string()) ); \
477 wdump( __VA_ARGS__ ); \
478 }

◆ FC_CAPTURE_AND_RETHROW

#define FC_CAPTURE_AND_RETHROW ( ...)
Value:
catch( const boost::interprocess::bad_alloc& ) {\
throw;\
} catch( fc::exception& er ) { \
FC_RETHROW_EXCEPTION( er, warn, "", FC_FORMAT_ARG_PARAMS(__VA_ARGS__) ); \
} catch( const std::exception& e ) { \
FC_LOG_MESSAGE( warn, "${what}: ",FC_FORMAT_ARG_PARAMS(__VA_ARGS__)("what",e.what())), \
std::current_exception(), \
BOOST_CORE_TYPEID(e).name(), \
e.what() ); \
throw sew;\
} catch( ... ) { \
FC_LOG_MESSAGE( warn, "",FC_FORMAT_ARG_PARAMS(__VA_ARGS__)), \
std::current_exception() ); \
}

Definition at line 523 of file exception.hpp.

523#define FC_CAPTURE_AND_RETHROW( ... ) \
524 catch( const boost::interprocess::bad_alloc& ) {\
525 throw;\
526 } catch( fc::exception& er ) { \
527 FC_RETHROW_EXCEPTION( er, warn, "", FC_FORMAT_ARG_PARAMS(__VA_ARGS__) ); \
528 } catch( const std::exception& e ) { \
529 fc::std_exception_wrapper sew( \
530 FC_LOG_MESSAGE( warn, "${what}: ",FC_FORMAT_ARG_PARAMS(__VA_ARGS__)("what",e.what())), \
531 std::current_exception(), \
532 BOOST_CORE_TYPEID(e).name(), \
533 e.what() ); \
534 throw sew;\
535 } catch( ... ) { \
536 throw fc::unhandled_exception( \
537 FC_LOG_MESSAGE( warn, "",FC_FORMAT_ARG_PARAMS(__VA_ARGS__)), \
538 std::current_exception() ); \
539 }

◆ FC_CAPTURE_AND_THROW

#define FC_CAPTURE_AND_THROW ( EXCEPTION_TYPE,
... )
Value:
FC_MULTILINE_MACRO_BEGIN \
throw EXCEPTION_TYPE( FC_LOG_MESSAGE( error, "", FC_FORMAT_ARG_PARAMS(__VA_ARGS__) ) ); \

Definition at line 374 of file exception.hpp.

374#define FC_CAPTURE_AND_THROW( EXCEPTION_TYPE, ... ) \
375 FC_MULTILINE_MACRO_BEGIN \
376 throw EXCEPTION_TYPE( FC_LOG_MESSAGE( error, "", FC_FORMAT_ARG_PARAMS(__VA_ARGS__) ) ); \
377 FC_MULTILINE_MACRO_END

◆ FC_CAPTURE_LOG_AND_RETHROW

#define FC_CAPTURE_LOG_AND_RETHROW ( ...)
Value:
catch( const boost::interprocess::bad_alloc& ) {\
throw;\
} catch( fc::exception& er ) { \
wlog( "${details}", ("details",er.to_detail_string()) ); \
wdump( __VA_ARGS__ ); \
FC_RETHROW_EXCEPTION( er, warn, "rethrow", FC_FORMAT_ARG_PARAMS(__VA_ARGS__) ); \
} catch( const std::exception& e ) { \
FC_LOG_MESSAGE( warn, "rethrow ${what}: ", FC_FORMAT_ARG_PARAMS( __VA_ARGS__ )("what",e.what())), \
std::current_exception(), \
BOOST_CORE_TYPEID(e).name(), \
e.what() ) ; \
wlog( "${details}", ("details",sew.to_detail_string()) ); \
wdump( __VA_ARGS__ ); \
throw sew;\
} catch( ... ) { \
FC_LOG_MESSAGE( warn, "rethrow", FC_FORMAT_ARG_PARAMS( __VA_ARGS__) ), \
std::current_exception() ); \
wlog( "${details}", ("details",e.to_detail_string()) ); \
wdump( __VA_ARGS__ ); \
throw e; \
}

Definition at line 433 of file exception.hpp.

433#define FC_CAPTURE_LOG_AND_RETHROW( ... ) \
434 catch( const boost::interprocess::bad_alloc& ) {\
435 throw;\
436 } catch( fc::exception& er ) { \
437 wlog( "${details}", ("details",er.to_detail_string()) ); \
438 wdump( __VA_ARGS__ ); \
439 FC_RETHROW_EXCEPTION( er, warn, "rethrow", FC_FORMAT_ARG_PARAMS(__VA_ARGS__) ); \
440 } catch( const std::exception& e ) { \
441 fc::std_exception_wrapper sew( \
442 FC_LOG_MESSAGE( warn, "rethrow ${what}: ", FC_FORMAT_ARG_PARAMS( __VA_ARGS__ )("what",e.what())), \
443 std::current_exception(), \
444 BOOST_CORE_TYPEID(e).name(), \
445 e.what() ) ; \
446 wlog( "${details}", ("details",sew.to_detail_string()) ); \
447 wdump( __VA_ARGS__ ); \
448 throw sew;\
449 } catch( ... ) { \
450 fc::unhandled_exception e( \
451 FC_LOG_MESSAGE( warn, "rethrow", FC_FORMAT_ARG_PARAMS( __VA_ARGS__) ), \
452 std::current_exception() ); \
453 wlog( "${details}", ("details",e.to_detail_string()) ); \
454 wdump( __VA_ARGS__ ); \
455 throw e; \
456 }

◆ FC_CHECK_DEADLINE

#define FC_CHECK_DEADLINE ( DEADLINE,
... )
Value:
FC_MULTILINE_MACRO_BEGIN \
if( DEADLINE < fc::time_point::maximum() && DEADLINE < fc::time_point::now() ) { \
auto log_mgs = FC_LOG_MESSAGE( error, "deadline ${d} exceeded by ${t}us ", \
FC_FORMAT_ARG_PARAMS(__VA_ARGS__)("d", DEADLINE)("t", fc::time_point::now() - DEADLINE) ); \
auto msg = log_mgs.get_limited_message(); \
throw fc::timeout_exception( std::move( log_mgs ), fc::timeout_exception_code, "timeout_exception", std::move( msg ) ); \
} \
static time_point now()
Definition time.cpp:14
static constexpr time_point maximum()
Definition time.hpp:46
@ timeout_exception_code
timeout exceptions
Definition exception.hpp:22

Definition at line 541 of file exception.hpp.

541#define FC_CHECK_DEADLINE( DEADLINE, ... ) \
542 FC_MULTILINE_MACRO_BEGIN \
543 if( DEADLINE < fc::time_point::maximum() && DEADLINE < fc::time_point::now() ) { \
544 auto log_mgs = FC_LOG_MESSAGE( error, "deadline ${d} exceeded by ${t}us ", \
545 FC_FORMAT_ARG_PARAMS(__VA_ARGS__)("d", DEADLINE)("t", fc::time_point::now() - DEADLINE) ); \
546 auto msg = log_mgs.get_limited_message(); \
547 throw fc::timeout_exception( std::move( log_mgs ), fc::timeout_exception_code, "timeout_exception", std::move( msg ) ); \
548 } \
549 FC_MULTILINE_MACRO_END

◆ FC_DECLARE_DERIVED_EXCEPTION

#define FC_DECLARE_DERIVED_EXCEPTION ( TYPE,
BASE,
CODE,
WHAT )

Definition at line 259 of file exception.hpp.

259#define FC_DECLARE_DERIVED_EXCEPTION( TYPE, BASE, CODE, WHAT ) \
260 class TYPE : public BASE \
261 { \
262 public: \
263 enum code_enum { \
264 code_value = CODE, \
265 }; \
266 explicit TYPE( int64_t code, const std::string& name_value, const std::string& what_value ) \
267 :BASE( code, name_value, what_value ){} \
268 explicit TYPE( fc::log_message&& m, int64_t code, const std::string& name_value, const std::string& what_value ) \
269 :BASE( std::move(m), code, name_value, what_value ){} \
270 explicit TYPE( fc::log_messages&& m, int64_t code, const std::string& name_value, const std::string& what_value )\
271 :BASE( std::move(m), code, name_value, what_value ){}\
272 explicit TYPE( const fc::log_messages& m, int64_t code, const std::string& name_value, const std::string& what_value )\
273 :BASE( m, code, name_value, what_value ){}\
274 TYPE( const std::string& what_value, const fc::log_messages& m ) \
275 :BASE( m, CODE, BOOST_PP_STRINGIZE(TYPE), what_value ){} \
276 TYPE( fc::log_message&& m ) \
277 :BASE( fc::move(m), CODE, BOOST_PP_STRINGIZE(TYPE), WHAT ){}\
278 TYPE( fc::log_messages msgs ) \
279 :BASE( fc::move( msgs ), CODE, BOOST_PP_STRINGIZE(TYPE), WHAT ) {} \
280 TYPE( const TYPE& c ) \
281 :BASE(c){} \
282 TYPE( const BASE& c ) \
283 :BASE(c){} \
284 TYPE():BASE(CODE, BOOST_PP_STRINGIZE(TYPE), WHAT){}\
285 \
286 virtual std::shared_ptr<fc::exception> dynamic_copy_exception()const\
287 { return std::make_shared<TYPE>( *this ); } \
288 virtual NO_RETURN void dynamic_rethrow_exception()const \
289 { if( code() == CODE ) throw *this;\
290 else fc::exception::dynamic_rethrow_exception(); \
291 } \
292 };

◆ FC_DECLARE_EXCEPTION

#define FC_DECLARE_EXCEPTION ( TYPE,
CODE,
WHAT )
Value:
#define FC_DECLARE_DERIVED_EXCEPTION(TYPE, BASE, CODE, WHAT)

Definition at line 294 of file exception.hpp.

294 #define FC_DECLARE_EXCEPTION( TYPE, CODE, WHAT ) \
295 FC_DECLARE_DERIVED_EXCEPTION( TYPE, fc::exception, CODE, WHAT )

◆ FC_EXCEPTION

#define FC_EXCEPTION ( EXCEPTION_TYPE,
FORMAT,
... )
Value:
EXCEPTION_TYPE( FC_LOG_MESSAGE( error, FORMAT, __VA_ARGS__ ) )

Definition at line 388 of file exception.hpp.

388#define FC_EXCEPTION( EXCEPTION_TYPE, FORMAT, ... ) \
389 EXCEPTION_TYPE( FC_LOG_MESSAGE( error, FORMAT, __VA_ARGS__ ) )

◆ FC_EXPAND_MACRO

#define FC_EXPAND_MACRO ( x)
Value:
x

Definition at line 358 of file exception.hpp.

◆ FC_INDIRECT_EXPAND

#define FC_INDIRECT_EXPAND ( MACRO,
ARGS )
Value:
MACRO ARGS

Definition at line 382 of file exception.hpp.

◆ FC_LOG_AND_DROP

#define FC_LOG_AND_DROP ( ...)
Value:
catch( const boost::interprocess::bad_alloc& ) {\
throw;\
} catch( fc::exception& er ) { \
wlog( "${details}", ("details",er.to_detail_string()) ); \
} catch( const std::exception& e ) { \
FC_LOG_MESSAGE( warn, "rethrow ${what}: ",FC_FORMAT_ARG_PARAMS( __VA_ARGS__ )("what",e.what()) ), \
std::current_exception(), \
BOOST_CORE_TYPEID(e).name(), \
e.what() ) ; \
wlog( "${details}", ("details",sew.to_detail_string()) ); \
} catch( ... ) { \
FC_LOG_MESSAGE( warn, "rethrow", FC_FORMAT_ARG_PARAMS( __VA_ARGS__) ), \
std::current_exception() ); \
wlog( "${details}", ("details",e.to_detail_string()) ); \
}

Definition at line 480 of file exception.hpp.

480#define FC_LOG_AND_DROP( ... ) \
481 catch( const boost::interprocess::bad_alloc& ) {\
482 throw;\
483 } catch( fc::exception& er ) { \
484 wlog( "${details}", ("details",er.to_detail_string()) ); \
485 } catch( const std::exception& e ) { \
486 fc::std_exception_wrapper sew( \
487 FC_LOG_MESSAGE( warn, "rethrow ${what}: ",FC_FORMAT_ARG_PARAMS( __VA_ARGS__ )("what",e.what()) ), \
488 std::current_exception(), \
489 BOOST_CORE_TYPEID(e).name(), \
490 e.what() ) ; \
491 wlog( "${details}", ("details",sew.to_detail_string()) ); \
492 } catch( ... ) { \
493 fc::unhandled_exception e( \
494 FC_LOG_MESSAGE( warn, "rethrow", FC_FORMAT_ARG_PARAMS( __VA_ARGS__) ), \
495 std::current_exception() ); \
496 wlog( "${details}", ("details",e.to_detail_string()) ); \
497 }

◆ FC_LOG_AND_RETHROW

FC_LOG_AND_RETHROW ( )
Value:
catch( const boost::interprocess::bad_alloc& ) {\
throw;\
} catch( fc::exception& er ) { \
wlog( "${details}", ("details",er.to_detail_string()) ); \
FC_RETHROW_EXCEPTION( er, warn, "rethrow" ); \
} catch( const std::exception& e ) { \
FC_LOG_MESSAGE( warn, "rethrow ${what}: ", ("what",e.what())), \
std::current_exception(), \
BOOST_CORE_TYPEID(e).name(), \
e.what() ) ; \
wlog( "${details}", ("details",sew.to_detail_string()) ); \
throw sew;\
} catch( ... ) { \
FC_LOG_MESSAGE( warn, "rethrow"), \
std::current_exception() ); \
wlog( "${details}", ("details",e.to_detail_string()) ); \
throw e; \
}

Definition at line 411 of file exception.hpp.

411#define FC_LOG_AND_RETHROW( ) \
412 catch( const boost::interprocess::bad_alloc& ) {\
413 throw;\
414 } catch( fc::exception& er ) { \
415 wlog( "${details}", ("details",er.to_detail_string()) ); \
416 FC_RETHROW_EXCEPTION( er, warn, "rethrow" ); \
417 } catch( const std::exception& e ) { \
418 fc::std_exception_wrapper sew( \
419 FC_LOG_MESSAGE( warn, "rethrow ${what}: ", ("what",e.what())), \
420 std::current_exception(), \
421 BOOST_CORE_TYPEID(e).name(), \
422 e.what() ) ; \
423 wlog( "${details}", ("details",sew.to_detail_string()) ); \
424 throw sew;\
425 } catch( ... ) { \
426 fc::unhandled_exception e( \
427 FC_LOG_MESSAGE( warn, "rethrow"), \
428 std::current_exception() ); \
429 wlog( "${details}", ("details",e.to_detail_string()) ); \
430 throw e; \
431 }

◆ FC_REGISTER_EXCEPTION

#define FC_REGISTER_EXCEPTION ( r,
unused,
base )
Value:

Definition at line 248 of file exception.hpp.

248#define FC_REGISTER_EXCEPTION(r, unused, base) \
249 fc::exception_factory::instance().register_exception<base>();

◆ FC_REGISTER_EXCEPTIONS

#define FC_REGISTER_EXCEPTIONS ( SEQ)
Value:
\
static bool exception_init = []()->bool{ \
BOOST_PP_SEQ_FOR_EACH( FC_REGISTER_EXCEPTION, v, SEQ ) \
return true; \
}(); \
#define FC_REGISTER_EXCEPTION(r, unused, base)

Definition at line 251 of file exception.hpp.

251#define FC_REGISTER_EXCEPTIONS( SEQ )\
252 \
253 static bool exception_init = []()->bool{ \
254 BOOST_PP_SEQ_FOR_EACH( FC_REGISTER_EXCEPTION, v, SEQ ) \
255 return true; \
256 }(); \
257

◆ FC_RETHROW_EXCEPTION

#define FC_RETHROW_EXCEPTION ( ER,
LOG_LEVEL,
FORMAT,
... )
Value:
FC_MULTILINE_MACRO_BEGIN \
ER.append_log( FC_LOG_MESSAGE( LOG_LEVEL, FORMAT, __VA_ARGS__ ) ); \
throw; \

Definition at line 405 of file exception.hpp.

405#define FC_RETHROW_EXCEPTION( ER, LOG_LEVEL, FORMAT, ... ) \
406 FC_MULTILINE_MACRO_BEGIN \
407 ER.append_log( FC_LOG_MESSAGE( LOG_LEVEL, FORMAT, __VA_ARGS__ ) ); \
408 throw; \
409 FC_MULTILINE_MACRO_END

◆ FC_RETHROW_EXCEPTIONS

#define FC_RETHROW_EXCEPTIONS ( LOG_LEVEL,
FORMAT,
... )
Value:
catch( const boost::interprocess::bad_alloc& ) {\
throw;\
} catch( fc::exception& er ) { \
FC_RETHROW_EXCEPTION( er, LOG_LEVEL, FORMAT, __VA_ARGS__ ); \
} catch( const std::exception& e ) { \
FC_LOG_MESSAGE( LOG_LEVEL, "${what}: " FORMAT,__VA_ARGS__("what",e.what())), \
std::current_exception(), \
BOOST_CORE_TYPEID(e).name(), \
e.what() ); \
throw sew;\
} catch( ... ) { \
FC_LOG_MESSAGE( LOG_LEVEL, FORMAT,__VA_ARGS__), \
std::current_exception() ); \
}

Definition at line 505 of file exception.hpp.

505#define FC_RETHROW_EXCEPTIONS( LOG_LEVEL, FORMAT, ... ) \
506 catch( const boost::interprocess::bad_alloc& ) {\
507 throw;\
508 } catch( fc::exception& er ) { \
509 FC_RETHROW_EXCEPTION( er, LOG_LEVEL, FORMAT, __VA_ARGS__ ); \
510 } catch( const std::exception& e ) { \
511 fc::std_exception_wrapper sew( \
512 FC_LOG_MESSAGE( LOG_LEVEL, "${what}: " FORMAT,__VA_ARGS__("what",e.what())), \
513 std::current_exception(), \
514 BOOST_CORE_TYPEID(e).name(), \
515 e.what() ); \
516 throw sew;\
517 } catch( ... ) { \
518 throw fc::unhandled_exception( \
519 FC_LOG_MESSAGE( LOG_LEVEL, FORMAT,__VA_ARGS__), \
520 std::current_exception() ); \
521 }

◆ FC_THROW

#define FC_THROW ( ...)
Value:
FC_MULTILINE_MACRO_BEGIN \
throw fc::exception( FC_INDIRECT_EXPAND(FC_LOG_MESSAGE, ( error, __VA_ARGS__ )) ); \
#define FC_INDIRECT_EXPAND(MACRO, ARGS)

Definition at line 383 of file exception.hpp.

383#define FC_THROW( ... ) \
384 FC_MULTILINE_MACRO_BEGIN \
385 throw fc::exception( FC_INDIRECT_EXPAND(FC_LOG_MESSAGE, ( error, __VA_ARGS__ )) ); \
386 FC_MULTILINE_MACRO_END

◆ FC_THROW_EXCEPTION

#define FC_THROW_EXCEPTION ( EXCEPTION,
FORMAT,
... )
Value:
FC_MULTILINE_MACRO_BEGIN \
throw EXCEPTION( FC_LOG_MESSAGE( error, FORMAT, __VA_ARGS__ ) ); \
Parameters
EXCEPTIONa class in the Phoenix::Athena::API namespace that inherits
format- a const char* string with "${keys}"

Definition at line 395 of file exception.hpp.

395#define FC_THROW_EXCEPTION( EXCEPTION, FORMAT, ... ) \
396 FC_MULTILINE_MACRO_BEGIN \
397 throw EXCEPTION( FC_LOG_MESSAGE( error, FORMAT, __VA_ARGS__ ) ); \
398 FC_MULTILINE_MACRO_END

◆ LIKELY

#define LIKELY ( x)
Value:
(x)

Definition at line 351 of file exception.hpp.

◆ UNLIKELY

#define UNLIKELY ( x)
Value:
(x)

Definition at line 352 of file exception.hpp.