chsvlib
chsv helper source code

Defines a class of objects specifying various exceptions with extended support for description formatting. . More...

#include <chsvexception.h>

Inheritance diagram for Exception:

Public Types

enum  vararg_tag_t { vararg_tag }
 

Public Member Functions

 Exception ()=default
 Construct a default exception object without specified description. The default description is a valid but unspecified C string.
 
template<class ... DescriptionFormatParams>
 Exception (const char *restrict lpszDescriptionFormat, DescriptionFormatParams ... formatting_params) noexcept
 Constructs an exception object with an optional description, specified by Chusov::String::PrintfA formatting rules. More...
 
template<class ... DescriptionFormatParams>
 Exception (const wchar_t *restrict lpszDescriptionFormat, DescriptionFormatParams ... formatting_params) noexcept
 Constructs an exception object with an optional description, specified by Chusov::String::PrintfW formatting rules. More...
 
 Exception (vararg_tag_t, const char *restrict lpszDescriptionFormat, std::va_list ap) noexcept
 Constructs an exception object with an optional description, specified by Chusov::String::PrintfA formatting rules. More...
 
 Exception (vararg_tag_t, const wchar_t *restrict lpszDescriptionFormat, std::va_list ap) noexcept
 Constructs an exception object with an optional description, specified by Chusov::String::PrintfW formatting rules. More...
 
template<class traits_t , class alloc_t >
 Exception (const std::basic_string< char, traits_t, alloc_t > &strDescription) noexcept
 Constructs an exception based on a textual description, represented as a multi-byte std::basic_string object. More...
 
template<class traits_t , class alloc_t >
 Exception (const std::basic_string< wchar_t, traits_t, alloc_t > &strDescription) noexcept
 Constructs an exception based on a textual description, represented as a wide std::basic_string object. More...
 
 Exception (const Exception &refRight)=default
 Standard copy constructor.
 
 Exception (Exception &&ex)=default
 Standard move constructor.
 
template<class StdExcept , class = std::enable_if_t<Implementation::is_std_except<StdExcept>::value>>
 Exception (StdExcept &&ex) noexcept
 
virtual ~Exception () noexcept
 A default destructor.
 
Exceptionoperator= (const Exception &)=default
 Standard copy assignment operator.
 
Exceptionoperator= (Exception &&)=default
 Standard move assignment operator.
 
virtual const char * what () const noexcept
 Returns a description, corresponding to the exception, represented as a multi-byte string constructed using the current locale.
 
virtual const wchar_t * What () const noexcept
 Returns a description, corresponding to the exception, represented as a wide string.
 

Protected Member Functions

void SetWhat (wchar_t *lpszOwnedWhat) noexcept
 
void SetWhat (char *lpszOwnedWhat) noexcept
 

Detailed Description

Defines a class of objects specifying various exceptions with extended support for description formatting. .

The class is the base type of exception objects defined in the chsvlib library and thrown by various components of libraries. The class supports constructing from inheritors of std::exception class.

The class supports two methods - what() and What() returning description of the exception as a multi-byte or wide string respectively.

The description can be specified during construction of objects of the Exception type using formatting rules given by the Chusov::String::Printf function.

There are several inheritors of the class specified in the same Exceptions namespace. These classes specialize the exceptions for various cases.

For exceptions that should be generated by an error code (either chsverror_t errors, or POSIX errno_t errors, or Windows system errors) use ExceptionWithGenericCode class template and its inheritors.

The methods of the class are guaranteed not to throw any exceptions in any case. Although, some basic operations underneath the class implementation may cause abortion of the running program.

See also
ExceptionWithGenericCode;
ChsvCodeExceptionTempl;
PlatformException;
ChsvExceptionByChsvCode;
ChsvExceptionByPosixCode;
Chusov::Win32::Exceptions::ChsvExceptionByWin32Code.
Examples
chsvexception\chsv_list_of_exceptions.cpp, chsvexception\nested_exceptions.cpp, and chsvwinutilex\CreateDACL.cpp.

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