CryptoSys PKI Pro Manual

PKI_FormatErrorMessage

Return a formatted error message string for the last error.

VBA/VB6 Syntax

No direct call from VBA/VB6. Use errFormatErrorMessage

C/C++ Syntax

long __stdcall PKI_FormatErrorMessage(char *szOutput, long nOutChars, long nErrCode, const char *szUserMsg);

Parameters

szOutput
[out] Buffer to receive output string.
nOutChars
[in] Maximum length of output string in bytes.
nErrCode
[in] Error code returned by last call (or zero if no code available).
szUserMsg
[in] Optional user message to add.

Returns (VBA/C)

The number of characters that have been set in szOutput.

.NET Equivalent

General.FormatErrorMessage Method

C++ (STL) Equivalent

static std::string dipki::Err::FormatErrorMessage (int errCode=0, const std::string &userMsg="")

Remarks

This is a combination of PKI_ErrorLookup, PKI_ErrorCode and PKI_LastError to give a complete formatted error message, for example

ERROR (11): Value out of range (OUT_OF_RANGE_ERROR)
ERROR: User message! (11): Value out of range (OUT_OF_RANGE_ERROR)
ERROR (21): No match found (NO_MATCH_ERROR): (1) Cannot open input file (OPEN_ERROR): Private key does not match any certificate in list

The equivalent functions in other languages are written independently and will give similar but not identical outputs.

The error message will never be longer than 1023 characters plus the length of any user message. In the raw ANSI C function you can query the expected length, but it is recommended to write directly to a fixed size buffer, as in the example below.

Example (C core function)

char szErrMsg[1024];
long errcode = 11;
PKI_FormatErrorMessage(szErrMsg, sizeof(szErrMsg) - 1, errcode, "User message!");
printf("%s\n", szErrMsg);
ERROR: User message! (11): Value out of range (OUT_OF_RANGE_ERROR)

See Also

PKI_ErrorLookup PKI_ErrorCode PKI_LastError Error codes

[Contents] [Index]

[PREV: PKI_ErrorLookup...]   [Contents]   [Index]   
   [NEXT: PKI_LastError...]

Copyright © 2004-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-09-23T07:52:09Z.