Open topic with navigation

# Error Handling

All functions in the zSpace Core SDK return ZSError, which is an enum. To get the corresponding string description, do the following:

1. Allocate a character buffer for the description.
2. Call zsGetErrorString(), with the error code, the buffer, and the size of the buffer.

If the buffer is too short, zsGetErrorString() will truncate the description to fit and return an error.

Here is a brief example:

    ZSError error = ...;
      if (error != ZS_ERROR_OKAY)
      {
        char errorString[256];
        zsGetErrorString(error, errorString, sizeof(errorString));
        printf("ZSError: %s\n", errorString);
      }

Open topic with navigation