Main Page   Modules  

Functions | Variables
CODA Error

Functions

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

Variables

THREAD_LOCAL int coda_errno
 

Error values

Note
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_OUT_OF_MEMORY   (-1)
 
#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_NOT_FOUND   (-20)
 
#define CODA_ERROR_FILE_OPEN   (-21)
 
#define CODA_ERROR_FILE_READ   (-22)
 
#define CODA_ERROR_FILE_WRITE   (-23)
 
#define CODA_ERROR_INVALID_ARGUMENT   (-100)
 
#define CODA_ERROR_INVALID_INDEX   (-101)
 
#define CODA_ERROR_INVALID_NAME   (-102)
 
#define CODA_ERROR_INVALID_FORMAT   (-103)
 
#define CODA_ERROR_INVALID_DATETIME   (-104)
 
#define CODA_ERROR_INVALID_TYPE   (-105)
 
#define CODA_ERROR_ARRAY_NUM_DIMS_MISMATCH   (-106)
 
#define CODA_ERROR_ARRAY_OUT_OF_BOUNDS   (-107)
 
#define CODA_ERROR_NO_PARENT   (-108)
 
#define CODA_ERROR_UNSUPPORTED_PRODUCT   (-200)
 
#define CODA_ERROR_PRODUCT   (-300)
 
#define CODA_ERROR_OUT_OF_BOUNDS_READ   (-301)
 
#define CODA_ERROR_DATA_DEFINITION   (-400)
 
#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

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

File not found.

◆ CODA_ERROR_FILE_OPEN

#define CODA_ERROR_FILE_OPEN   (-21)

Could not open file.

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

Invalid argument.

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

Invalid index argument.

◆ CODA_ERROR_INVALID_NAME

#define CODA_ERROR_INVALID_NAME   (-102)

Invalid name argument.

◆ CODA_ERROR_INVALID_TYPE

#define CODA_ERROR_INVALID_TYPE   (-105)

Invalid type.

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

Cursor has no parent.

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

Out of memory.

◆ 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

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

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