chsvlib
chsv helper source code

◆ ChsvExceptionByChsvCode() [3/4]

void Chusov::Exceptions::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. .

Template Parameters
fProcessSuccessCodeAsUnknownErroris a flag specifying if the success code should be processed as an unknown error. That means that if the flag is set, and a value of the error code is CHSVERROR_SUCCESS, then the thrown exception is UnknownException. Otherwise, it is ChsvCodeExceptionTempl<CHSVERROR_SUCCESS>.
DescriptionFormatParamsDeduced types of additional arguments passed to the function to format the message.
Parameters
[in]nCodeis a chsvlib error code. If a value of the code corresponds to one of the errors defined in the chsverr.h header, the exception produced is a corresponding ChsvCodeExceptionTempl instantiation (see predefined exceptions). Otherwise, the produced exception is of the UnknownException type.
[in]pszDescriptionis a pointer to a zero-terminated string specifying formatting rules used by the function during construction of the exception to be thrown. The formatting sequences are specified with respect to the Chusov::String::PrintfA. Also, the <CODE> and <DESCRIPTION> tags are allowed in the string to be replaced by a numeric representation of the error code and its description, which is returned by the Chusov::ChsvErrorDescriptionA function, respectively.
format_paramsis a set of additional parameters specified by the caller with respect to the formatting string pointed to by the pszDescription parameter. The parameters, as well as the formatting string, should be specified following the rules given by the Chusov::String::PrintfA function.