Sets a new exception description, according to the specified error code, formatting rules (without tag customization), variadic list of parameters and a function object mapping the error code to its default string description.
- Template Parameters
-
char_t | is a type of the description to be set which is either char or wchar_t . |
DescriptionFormatParams | Deduced types of additional arguments passed to the function to format the message. |
- Parameters
-
[in] | nCode | is a numeric value of the error code. |
[in] | lpszDescriptionFormat | is an optional pointer to a string specifying a format of the constructed description. |
[in] | formatting_params | Additional parameters to be used during the construction of the description, as specified for the Chusov::String::Printf <char_t> function. If lpszDescriptionFormat is NULL, the parameter list is ignored. |
The function performs formatting of the output string using control character sequences and arguments of the formatting_params
pack as specified for the Chusov::String::Printf <char_t> function. The result is then analyzed for presence of the tags "\<CODE\>" and "\<DESCRIPTION\>". The former is replaced with a hexadecimal representation of the error code nCode
. If the "\<DESCRIPTION\>" tag is encountered in the string, it is replaced with a message saying that the description is unspecified. To specify the description use one of the other overloads of SetCodeAndDescription
.
After these two transformations, the resulting string becomes a message associated with the exception object and obtained using Exception::what or Exception::What.