chsvlib
chsv helper source code
Exception handling classes and functions.

Generic exception classes and helper functions. More...

Collaboration diagram for Exception handling classes and functions.:

Modules

 Predefined exceptions
 Classes of exceptions which correspond to predefined error codes.
 

Classes

class  Exception
 Defines a class of objects specifying various exceptions with extended support for description formatting. . More...
 
class  ExceptionWithGenericCode< code_t, class >
 A class template specifying a generic exception which has a corresponding integral error code. More...
 
struct  ChsvCodeExceptionTempl< errc >
 A template defining classes depending on the specified chsvlib error code. . More...
 
class  PlatformException< pltfrm_code_t >
 A class template designed specifically for using with externally defined error codes. More...
 
struct  code_based_exception< exception_code >
 Defines a nested type alias to a chsvlib exception depending on the chsvlib error code. More...
 
class  nested_exception
 Together with throw_with_nested and rethrow_if_nested implements a behaviour of the standard C++11 nested exceptions mechanism as defined by the std::nested_exception class and by the std::throw_with_nested and std::rethrow_if_nested functions respectively. . More...
 

Macros

#define chsv_monitor_exceptions   Chusov::Exceptions::Implementation::ExceptionStack_t chsv_impl_trace_db(__FILE__, STRINGIFY(__LINE__), __func__, __WFILE__, STRINGIFYW(__LINE__), __wfunc__)
 Turns on exception tracing during stack unwinding within a function. More...
 
#define chsv_list_of_exceptions   Chusov::Exceptions::Implementation::ExceptionStack_t::get_list()
 Returns a list of registered exceptions thrown within a current thread with the front elements being the top-level functions and the back elements being the deepest stack calls. More...
 
#define chsv_monitor_exceptions_debug   Chusov::Exceptions::Implementation::ExceptionStack_t chsv_impl_trace_db(__FILE__, STRINGIFY(__LINE__), __func__, __WFILE__, STRINGIFYW(__LINE__), __wfunc__)
 If the build configuration is set to debug, the definition turns on exception tracing during stack unwinding within a function. More...
 

Typedefs

typedef ExceptionWithGenericCode< chsverror_tChsvCodeException
 An alias for the type of exception objects to be bound with chsvlib error codes.
 
template<chsverror_t exception_code>
using code_based_exception_t = typename code_based_exception< exception_code >::type
 A type alias for an exception class which corresponds to the given error code. More...
 

Functions

template<bool fProcessSuccessCodeAsUnknownError = true, class ... DescriptionFormatParams>
void ChsvExceptionByChsvCode (chsverror_t nCode, const char *restrict pszDescription, DescriptionFormatParams ... format_params)
 Creates an instance of the ChsvCodeExceptionTempl class, bound with the specified chsvlib error code, and throws it as an exception. . More...
 
template<bool fProcessSuccessCodeAsUnknownError = true, class ... DescriptionFormatParams>
void ChsvExceptionByChsvCode (chsverror_t nCode, const wchar_t *restrict pszDescription, DescriptionFormatParams ... format_params)
 Creates an instance of the ChsvCodeExceptionTempl class, bound with the specified chsvlib error code, and throws it as an exception. . More...
 
template<bool fProcessSuccessCodeAsUnknownError = true>
void ChsvExceptionByChsvCode (chsverror_t nCode)
 Creates an instance of the ChsvCodeExceptionTempl class, bound with the specified chsvlib error code, and throws it as an exception. More...
 
template<bool fProcessSuccessCodeAsUnknownError = true>
void ChsvExceptionByChsvCode ()
 Constructs and throws an exception object by a chsvlib error code returned by the GetLastChsvError function. More...
 
template<bool fProcessSuccessCodeAsUnknownError = true, class ... DescriptionFormatParams>
void ChsvExceptionByPosixCode (errno_t nCode, const char *restrict pszDescription, DescriptionFormatParams ... format_params)
 Creates an instance of the ChsvCodeExceptionTempl class and throws it as an exception. The instantiation of the ChsvCodeExceptionTempl class template is chosen depending on the result of a translation of the specified POSIX error code to the corresponding chsvlib error code. . More...
 
template<bool fProcessSuccessCodeAsUnknownError = true, class ... DescriptionFormatParams>
void ChsvExceptionByPosixCode (errno_t nCode, const wchar_t *restrict pszDescription, DescriptionFormatParams ... format_params)
 Creates an instance of the ChsvCodeExceptionTempl class and throws it as an exception. The instantiation of the ChsvCodeExceptionTempl class template is chosen depending on the result of a translation of the specified POSIX error code to the corresponding chsvlib error code. . More...
 
template<bool fProcessSuccessCodeAsUnknownError = true>
void ChsvExceptionByPosixCode (errno_t nCode)
 
template<bool fProcessSuccessCodeAsUnknownError = true>
void ChsvExceptionByPosixCode ()
 
template<bool fProcessSuccessCodeAsUnknownError = true, class ... DescriptionFormatParams>
void ChsvExceptionByWindowsCode (unsigned long nCode, const char *restrict pszDescription, DescriptionFormatParams ... format_params)
 Creates an instance of the ChsvCodeExceptionTempl class and throws it as an exception. The instantiation of the ChsvCodeExceptionTempl class template is chosen depending on the result of a translation of the specified Windows error code to the corresponding chsvlib error code. More...
 
template<bool fProcessSuccessCodeAsUnknownError = true, class ... DescriptionFormatParams>
void ChsvExceptionByWindowsCode (unsigned long nCode, const wchar_t *restrict pszDescription, DescriptionFormatParams ... format_params)
 Creates an instance of the ChsvCodeExceptionTempl class and throws it as an exception. The instantiation of the ChsvCodeExceptionTempl class template is chosen depending on the result of a translation of the specified Windows error code to the corresponding chsvlib error code. More...
 
template<bool fProcessSuccessCodeAsUnknownError = true>
void ChsvExceptionByWindowsCode (unsigned long nCode)
 
template<bool fProcessSuccessCodeAsUnknownError = true>
void ChsvExceptionByWindowsCode ()
 
template<bool fProcessSuccessCodeAsUnknownError = true, class ... DescriptionFormatParams>
void ChsvExceptionByPlatformCode (chsv_syserror_t nCode, const char *restrict pszDescription, DescriptionFormatParams ... format_params)
 Creates an instance of the ChsvCodeExceptionTempl class and throws it as an exception. The instantiation of the ChsvCodeExceptionTempl class template is chosen depending on the result of a translation of the specified operating system error code to the corresponding chsvlib error code. More...
 
template<bool fProcessSuccessCodeAsUnknownError = true, class ... DescriptionFormatParams>
void ChsvExceptionByPlatformCode (chsv_syserror_t nCode, const wchar_t *restrict pszDescription, DescriptionFormatParams ... format_params)
 Creates an instance of the ChsvCodeExceptionTempl class and throws it as an exception. The instantiation of the ChsvCodeExceptionTempl class template is chosen depending on the result of a translation of the specified operating system error code to the corresponding chsvlib error code. More...
 
template<bool fProcessSuccessCodeAsUnknownError = true>
void ChsvExceptionByPlatformCode (chsv_syserror_t nCode)
 
template<bool fProcessSuccessCodeAsUnknownError = true>
void ChsvExceptionByPlatformCode ()
 
void RethrowStdExceptionAsChsvException (std::exception_ptr eptr)
 Tries to rethrow an exception pointed to by the parameter as a predefined exception. If there is no predefined match to the input exception, the function throws the exception as it is. More...
 
template<class E >
void throw_with_nested (E &&e)
 Implements a behaviour of the standard std::throw_with_nested function storing an exception having been caught by a caller and retrieved by a call to the std::current_exception function in the constructed nested_exception object and throwing an exception specified by the only parameter. . More...
 
template<class E >
void rethrow_if_nested (E &&e)
 Implements a behaviour of the standard std::rethrow_if_nested function checking if the most derived dynamic type of the specified exception inherits the nested_exception class and, if that is true, throws an exception stored by the nested_exception object calling nested_exception::rethrow_nested(). If an exception object given by the parameter is not dynamically connected with the nested_exception class through inheritance, the function does nothing. . More...
 

Detailed Description

Generic exception classes and helper functions.

The group includes generic functionality and classes defined for chsvlib exceptions.