With a few exceptions almost all CODA functions return an integer that indicate whether the function was able to perform its operations successfully. The return value will be 0 on success and -1 otherwise. In case you get a -1 you can look at the global variable coda_errno for a precise error code. Each error code and its meaning is described in this section. You will also be able to retrieve a character string with an error description via the coda_errno_to_string() function. This function will return either the default error message for the error code, or a custom error message. A custom error message will only be returned if the error code you pass to coda_errno_to_string() is equal to the last error that occurred and if this last error was set with a custom error message. The CODA error state can be set with the coda_set_error() function.
◆ CODA_ERROR_ARRAY_NUM_DIMS_MISMATCH
#define CODA_ERROR_ARRAY_NUM_DIMS_MISMATCH (-106) |
Incorrect number of dimensions argument.
◆ CODA_ERROR_ARRAY_OUT_OF_BOUNDS
#define CODA_ERROR_ARRAY_OUT_OF_BOUNDS (-107) |
Array index out of bounds.
◆ CODA_ERROR_DATA_DEFINITION
#define CODA_ERROR_DATA_DEFINITION (-400) |
There was an error detected in the CODA Data Definitions.
◆ CODA_ERROR_EXPRESSION
#define CODA_ERROR_EXPRESSION (-401) |
There was an error detected while parsing or evaluating an expression.
◆ CODA_ERROR_FILE_NOT_FOUND
#define CODA_ERROR_FILE_NOT_FOUND (-20) |
◆ CODA_ERROR_FILE_OPEN
#define CODA_ERROR_FILE_OPEN (-21) |
◆ CODA_ERROR_FILE_READ
#define CODA_ERROR_FILE_READ (-22) |
Could not read data from file.
◆ CODA_ERROR_FILE_WRITE
#define CODA_ERROR_FILE_WRITE (-23) |
Could not write data to file.
◆ CODA_ERROR_HDF4
#define CODA_ERROR_HDF4 (-10) |
An error occurred in the HDF4 library.
◆ CODA_ERROR_HDF5
#define CODA_ERROR_HDF5 (-12) |
An error occurred in the HDF5 library.
◆ CODA_ERROR_INVALID_ARGUMENT
#define CODA_ERROR_INVALID_ARGUMENT (-100) |
◆ CODA_ERROR_INVALID_DATETIME
#define CODA_ERROR_INVALID_DATETIME (-104) |
Invalid date/time argument.
◆ CODA_ERROR_INVALID_FORMAT
#define CODA_ERROR_INVALID_FORMAT (-103) |
Invalid format in argument.
◆ CODA_ERROR_INVALID_INDEX
#define CODA_ERROR_INVALID_INDEX (-101) |
◆ CODA_ERROR_INVALID_NAME
#define CODA_ERROR_INVALID_NAME (-102) |
◆ CODA_ERROR_INVALID_TYPE
#define CODA_ERROR_INVALID_TYPE (-105) |
◆ CODA_ERROR_NO_HDF4_SUPPORT
#define CODA_ERROR_NO_HDF4_SUPPORT (-11) |
No HDF4 support built into CODA.
◆ CODA_ERROR_NO_HDF5_SUPPORT
#define CODA_ERROR_NO_HDF5_SUPPORT (-13) |
No HDF5 support built into CODA.
◆ CODA_ERROR_NO_PARENT
#define CODA_ERROR_NO_PARENT (-108) |
◆ CODA_ERROR_OUT_OF_BOUNDS_READ
#define CODA_ERROR_OUT_OF_BOUNDS_READ (-301) |
Trying to read outside the element boundary. This happens if there was a read beyond the end of the product or a read outside the range of an enclosing element such as an XML element. This error usually means that either the product or its definition in CODA contains an error.
◆ CODA_ERROR_OUT_OF_MEMORY
#define CODA_ERROR_OUT_OF_MEMORY (-1) |
◆ CODA_ERROR_PRODUCT
#define CODA_ERROR_PRODUCT (-300) |
There was an error detected in the product.
◆ CODA_ERROR_UNSUPPORTED_PRODUCT
#define CODA_ERROR_UNSUPPORTED_PRODUCT (-200) |
Unsupported product file. This means that either the product format is not supported or that it was not possible to determine the product type and version of the file.
◆ CODA_ERROR_XML
#define CODA_ERROR_XML (-14) |
An error occurred while parsing an XML data block.
◆ CODA_SUCCESS
◆ coda_errno_to_string()
const char * coda_errno_to_string |
( |
int | err | ) |
|
Returns a string with the description of the CODA error. If err equals the current CODA error status then this function will return the error message that was last set using coda_set_error(). If the error message argument to coda_set_error() was NULL or if err does not equal the current CODA error status then the default error message for err will be returned.
- Parameters
-
- Returns
- String with a description of the CODA error.
◆ coda_set_error()
void coda_set_error |
( |
int | err, |
|
|
const char * | message, |
|
|
| ... ) |
Set the error value and optionally set a custom error message. If message is NULL then the default error message for the error number will be used.
- Parameters
-
err | Value of coda_errno. |
message | Optional error message using printf() format. |
◆ coda_errno
THREAD_LOCAL int coda_errno |
Variable that contains the error type. If no error has occurred the variable contains CODA_SUCCESS (0).