Specifications
Error Handling
3-1
3
This chapter describes the error handling facility of the Image Processing
Library. The library functions report a variety of errors including bad
arguments and out-of-memory conditions.
Most functions in the library do not return any status code. When a
function detects an error, it sets the error status code by calling
iplSetErrStatus(). This allows the error handling mechanism to work
separately from the normal flow of the image processing code. Thus, the
code is cleaner and more compact as shown in this example:
ColorTwist = iplSetColorTwist(data,
scalingValue
);
if(iplGetErrStatus()<0) // check for errors
The error handling system is hidden within the function
iplSetColorTwist(). As a result, this statement is uncluttered by error
handling code and closely resembles a mathematical formula.
Your application should assume that every library function call may result
in some error condition. The Image Processing Library performs extensive
error checks (for example,
NULL pointers, out-of-range parameters,
corrupted states) for every library function.
Error macros are provided to simplify the coding for error checking and
reporting. You can modify the way your application handles errors by
calling
iplRedirectError() with a pointer to your own error handling
function. For more information, see “Adding Your Own Error Handler”
later in this chapter. For even more flexibility, you can replace the whole
error handling facility with your own code. The source code of the default
error handling facility is provided.
The Image Processing Library does not process numerical exceptions (for
example, overflow, underflow, and division by zero). The underlying
floating point library or processor has the responsibility for catching and