NVIDIA DRIVE OS Linux SDK API Reference

5.2.0 Release
For Test and Development only
Error Handling

Detailed Description

nverror.h contains our error code enumeration and helper macros.

Macros

#define NV_CHECK_ERROR(expr)
 A helper macro to check a function's error return code and propagate any errors upward. More...
 
#define NV_CHECK_ERROR_CLEANUP(expr)
 A helper macro to check a function's error return code and, if an error occurs, jump to a label where cleanup can take place. More...
 

Enumerations

enum  NvError {
  NvSuccess = NvError_Success,
  NvError_Force32 = 0x7FFFFFFF
}
 The NvError enumeration contains ALL return / error codes. More...
 

Macro Definition Documentation

◆ NV_CHECK_ERROR

#define NV_CHECK_ERROR (   expr)
Value:
do \
{ \
e = (expr); \
if (e != NvSuccess) \
return e; \
} while (0)

A helper macro to check a function's error return code and propagate any errors upward.

This assumes that no cleanup is necessary in the event of failure. This macro does not locally define its own NvError variable out of fear that this might burn too much stack space, particularly in debug builds or with mediocre optimizing compilers. The user of this macro is therefore expected to provide their own local variable "NvError e;".

Definition at line 55 of file nverror.h.

◆ NV_CHECK_ERROR_CLEANUP

#define NV_CHECK_ERROR_CLEANUP (   expr)
Value:
do \
{ \
e = (expr); \
if (e != NvSuccess) \
goto fail; \
} while (0)

A helper macro to check a function's error return code and, if an error occurs, jump to a label where cleanup can take place.

Like NV_CHECK_ERROR, this macro does not locally define its own NvError variable. (Even if we wanted it to, this one can't, because the code at the "fail" label probably needs to do a "return e;" to propagate the error upwards.)

Definition at line 70 of file nverror.h.

Enumeration Type Documentation

◆ NvError

enum NvError

The NvError enumeration contains ALL return / error codes.

Error codes are specifically explicit to make it easy to identify where an error came from.

All error codes are derived from the macros in nverrval.h.

Enumerator
NvSuccess 
NvError_Force32 

Max value for nv-error.

Definition at line 32 of file nverror.h.

NvSuccess
@ NvSuccess
Definition: nverror.h:41