CryptoSys API Library Manual

API_ErrorCode

Returns the error code of the error that occurred when calling the last function.

VBA/VB6 Syntax

Public Declare Function API_ErrorCode Lib "diCryptoSys.dll" () As Long

nRet = API_ErrorCode()

C/C++ Syntax

long __stdcall API_ErrorCode(void);

Parameters

None.

Returns (VBA/C)

Returns the error code of the error that occurred when calling the last function, or zero if no error occurred.

.NET Equivalent

General.ErrorCode Method
General.FormatErrorMessage Method

C++ (STL) Equivalent

static int crsysapi::Err::ErrorCode ()

Python Equivalent

static Gen.error_code()

Remarks

The value returned is always a non-negative integer greater than or equal to zero. Not all functions set this value.

Example

Dim nErrCode as Long
nErrCode = API_ErrorCode()
Debug.Print "API_ErrorCode=" & API_ErrorCode() & ": " & apiErrorLookup(API_ErrorCode())
API_ErrorCode=19: Item is not supported (NOT_SUPPORTED_ERROR)

A sample function in C to display error details.

/** Display error codes and corresponding message.
@param nRet Error code returned by last function.
*/
static void disp_error(long nRet)
{
    long errcode;
    char errmsg[128] = { 0 };
    // Get error that occurred when calling last function (if any)
    errcode = API_ErrorCode();
    // Lookup message for error code
    if (errcode != 0)
        API_ErrorLookup(errmsg, sizeof(errmsg), errcode);
    else 
        API_ErrorLookup(errmsg, sizeof(errmsg), nRet);
    printf("ERROR Returned=%ld/Code=%ld: %s\n", nRet, errcode, errmsg);
}
HASH_DigestLength returns -64
ERROR Returned=-64/Code=64: Invalid context handle (INVALID_HANDLE_ERROR)

See Also

API_ErrorLookup

[Contents] [Index]

[PREV: API_CompileTime...]   [Contents]   [Index]   
   [NEXT: API_ErrorLookup...]

Copyright © 2001-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-01-07T07:42:00Z.