Main Page   Modules  

Functions | Variables
CODA Error


void coda_set_error (int err, const char *message,...)
const char * coda_errno_to_string (int err)


THREAD_LOCAL int coda_errno

Error values

Error values in the range -900..-999 are reserved for use by layers built on top of the CODA library.
#define CODA_SUCCESS   (0)
#define CODA_ERROR_HDF4   (-10)
#define CODA_ERROR_NO_HDF4_SUPPORT   (-11)
#define CODA_ERROR_HDF5   (-12)
#define CODA_ERROR_NO_HDF5_SUPPORT   (-13)
#define CODA_ERROR_XML   (-14)
#define CODA_ERROR_FILE_OPEN   (-21)
#define CODA_ERROR_FILE_READ   (-22)
#define CODA_ERROR_FILE_WRITE   (-23)
#define CODA_ERROR_INVALID_NAME   (-102)
#define CODA_ERROR_INVALID_TYPE   (-105)
#define CODA_ERROR_NO_PARENT   (-108)
#define CODA_ERROR_PRODUCT   (-300)
#define CODA_ERROR_EXPRESSION   (-401)

Detailed Description

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.

Macro Definition Documentation



Incorrect number of dimensions argument.



Array index out of bounds.



There was an error detected in the CODA Data Definitions.


#define CODA_ERROR_EXPRESSION   (-401)

There was an error detected while parsing or evaluating an expression.



File not found.


#define CODA_ERROR_FILE_OPEN   (-21)

Could not open file.


#define CODA_ERROR_FILE_READ   (-22)

Could not read data from file.


#define CODA_ERROR_FILE_WRITE   (-23)

Could not write data to file.


#define CODA_ERROR_HDF4   (-10)

An error occurred in the HDF4 library.


#define CODA_ERROR_HDF5   (-12)

An error occurred in the HDF5 library.



Invalid argument.



Invalid date/time argument.



Invalid format in argument.



Invalid index argument.


#define CODA_ERROR_INVALID_NAME   (-102)

Invalid name argument.


#define CODA_ERROR_INVALID_TYPE   (-105)

Invalid type.


#define CODA_ERROR_NO_HDF4_SUPPORT   (-11)

No HDF4 support built into CODA.


#define CODA_ERROR_NO_HDF5_SUPPORT   (-13)

No HDF5 support built into CODA.


#define CODA_ERROR_NO_PARENT   (-108)

Cursor has no parent.



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.



Out of memory.


#define CODA_ERROR_PRODUCT   (-300)

There was an error detected in the product.



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.


#define CODA_ERROR_XML   (-14)

An error occurred while parsing an XML data block.


#define CODA_SUCCESS   (0)

Success (no error).

Function Documentation

◆ 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.

errValue of coda_errno.
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.

errValue of coda_errno.
messageOptional error message using printf() format.

Variable Documentation

◆ coda_errno

THREAD_LOCAL int coda_errno

Variable that contains the error type. If no error has occurred the variable contains CODA_SUCCESS (0).