The file contains definitions of various exceptions thrown by the mechanisms of the chsvcode library and can be used by clients. More...
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 | ExceptionWithGenericCode< code_t, class >::noprintf |
An empty type defining an overload of SetCodeAndDescription method that discards Printf formatting during construction of an exception description. More... | |
struct | ChsvCodeExceptionTempl< errc > |
A template defining classes depending on the specified chsvlib error code. . More... | |
struct | ChsvCodeExceptionTempl< errc >::noformat |
A type used to overload protected formatting methods in order to turn off the Printf formatting. More... | |
struct | OutOfMemoryException |
Insufficient memory exception. More... | |
struct | InvalidParameterException |
Invalid parameter exception. More... | |
struct | InsufficientBufferException |
Insufficient buffer exception. More... | |
struct | OutOfRangeException |
Out of range exception. More... | |
struct | InitializationFailureException |
Initialization failure exception. More... | |
struct | NotInitializedException |
Reading an uninitialized resource exception. More... | |
struct | AlreadyInitializedException |
Initializing an already initialized resource exception. More... | |
struct | InvalidVersionException |
Improper version exception. More... | |
struct | NotFoundException |
Item not found exception. More... | |
struct | AlreadyExistsException |
Resource already exists exception. More... | |
struct | InvalidResourceException |
Invalid resource exception. More... | |
struct | AccessDeniedException |
Access denied exception. More... | |
struct | StorageFullnessException |
Storage full exception. More... | |
struct | InvalidCharSequenceException |
Invalid multibyte character sequence exception. More... | |
struct | OperationCancelledException |
Operation is cancelled exception. More... | |
struct | NameTooLongException |
Name is too long exception. More... | |
struct | PossibleDeadlockException |
Possible deadlock exception. More... | |
struct | TimeoutException |
Timeout exception. More... | |
struct | OwnerDeadException |
A thread owning a resource is dead. More... | |
struct | UnsupportedCallException |
Unsupported (unimplemented) call exception. More... | |
struct | ArithmeticOverflowException |
Arithmetic overflow exception. More... | |
struct | StackOverflowException |
Stack overflow exception. More... | |
struct | UnknownException |
Unknown exception corresponding to an unknown 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... | |
Namespaces | |
Chusov | |
Basic chsvlib namespace. | |
Chusov::Exceptions | |
A namespace for chsvlib generic exception classes and for special helper function. | |
Macros | |
#define | EXCEPTIONS_BEGIN namespace Exceptions { |
Defines the beginning of the Chusov::Exceptions namespace without defining the encapsulating namespace. More... | |
#define | EXCEPTIONS_END } |
Defines the end of the Chusov::Exceptions namespace. More... | |
#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_t > | ChsvCodeException |
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... | |
The file contains definitions of various exceptions thrown by the mechanisms of the chsvcode library and can be used by clients.
<CODE>
and <DESCRIPTION>
(as well as <PLATFORM_CODE>
and <PLATFORM_DESCRIPTION>
) tags may be a more convenient way to include corresponding substrings into the description than using calling constructs like
compared to
The first call, that involves an std::wstring object, has the following drawbacks:
The second call has the following drawbacks:
Composite C++ objects cannot be included straightforwardly into the definition of the description format and this inclusion would require either additional formatting of the format string with the first method, e.g.:
or by providing functions converting the objects into a string (which as an automatically managed object), like:
Still, it may be somewhat better than
new operator can also throw std::bad_alloc exception, but available overloads of functions in chsvmem.h cannot.