You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

The LMX_GetErrorMessageSimple function retrieves a string for a corresponding status value.

Prototype

const char * LMX_GetErrorMessageSimple
(
   LMX_STATUS LmxStat
);

Parameters

LmxStat
[in] Error status variable.

Return values

The return value is a pointer to a NULL-terminated string that contains descriptive text for the error code.

Example

The following example shows an error caused by checking out a non-existent feature. It also shows information contained in the LMX_ERROR_INFO structure and calls an exit() function.

#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;
}

You can use the following code to print out the name of the corresponding LM-X return code in the format described in Return codes.

#include <lmx.h>
#include <stdio.h>

int main() {
  LMX_STATUS s = LMX_INVALID_PARAMETER;
  fprintf(stderr, "%s\n", LMX_GetErrorMessageSimple(s));
  return 0;
}
  • No labels