chsvlib
chsv helper source code

◆ ExceptionWithGenericCode() [10/10]

ExceptionWithGenericCode ( code_t  nCode,
std::nullptr_t  ,
const std::basic_string< char_t, traits_t, alloc_t > &  strDescriptionFormat 
)
noexcept

Constructs an exception object by a specified error code, and a description provided by an std::basic_string object. .

Template Parameters
char_tis a type of a symbol of an std::basic_string object specifying the description.
traits_tis a type of a character traits class that is used by the std::basic_string template.
alloc_tis a type of an allocator class used by the std::basic_string template.
Parameters
[in]nCodeis a code to be associated with the constructed exception object.
[in]strDescriptionFormatis an std::basic_string object specifying the description. Unlike other constructors, the current one performs neither tag nor Printf formatting. The string is set as the description of the exception "as-is". However, if the string is empty, the actual description set is a notification saying that the description is not specified.

The constructor creates an instance of the ExceptionWithGenericCode<code_t> class with associated error code and the description. The description is constructed without any formatting, performed by other constructors of the ExceptionWithGenericCode class.

Remarks
The function is provided to resolve compatibility issues with compilers which do not support expression SFINAE (e.g. MSVC prior to version 14 with update 2). More convenient alternative which does require the expression SFINAE support which is provided by the class conditionally.
See also
ExceptionWithGenericCode(code_t nCode, fn_t&& GetDescription, const char_t* restrict lpszDescriptionFormat, DescriptionFormatParams... formatting_params);
ExceptionWithGenericCode(code_t nCode, fn_t&& GetDescription, Exception::vararg_tag_t, _In_opt_z_ const char_t* RESTRICT lpszDescriptionFormat, std::va_list ap);
ExceptionWithGenericCode(code_t nCode, Exception::vararg_tag_t, _In_opt_z_ const char_t* RESTRICT lpszDescriptionFormat, std::va_list ap).