Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The LMX_GetError function returns an error structure containing the complete error message.

Prototype

Code Block
languagecpp
const LMX_ERROR_INFO *LMX_GetError
(
   LMX_HANDLE LmxHandle
);

Parameters

LmxHandle
[in/out] LM-X handle.

...

The return value is a pointer to a structure containing the error information. See the lmx.h header file for details on this structure.

Remarks

This function is useful for custom error processing, when you want to display the error message from LM-X in a custom format.

...

Code Block
languagecpp
#include <lmx.h>
#include <stdio.h>

LMX_HANDLE h;

int main() 
{
  LMX_STATUS s;
  
  exit_on_error(LMX_Init(&h));
  if ((s = LMX_Checkout(h,"nonExistingFeature", 1, 1, 1)) != LMX_SUCCESS) 
  {
    const LMX_ERROR_INFO* ePtr = LMX_GetError(h);
    fprintf(stderr, "Status: %s\n", LMX_GetErrorMessageSimple(s));
    fprintf(stderr, "Line: %d\n", ePtr->nInternal);
    fprintf(stderr, "Error code: %d\n", ePtr->nContext);
    fprintf(stderr, "Description: %s\n", ePtr->szDescription);
    fprintf(stderr, "Feature: %s\n", ePtr->szFeatureName);
    fflush(stderr);
    exit(1);
  }
  return 0;
}