The ilGetError function returns error information.
ilGetError returns the value of the last error on the error stack. If no error has occurred, IL_NO_ERROR is returned. Initially, the error stack is set to IL_NO_ERROR. When ilGetError is called, the last error on the error stack is "popped off". Errors that occur in ILU and ILUT are also reported through ilGetError. ilGetError only returns something other than IL_NO_ERROR if detectable errors have occurred. A simple (but potentially deadly) use of ilGetError could be:
- while (ilGetError() != IL_NO_ERROR);
This is alright when very simple operations have been performed, but a more robust solution is needed to check for harmful errors, such as IL_OUT_OF_MEMORY. A list of errors that may be returned follow:
- No detectable error has occured.
- IL_INVALID_ENUM, ILU_INVALID_ENUM, ILUT_INVALID_ENUM
- An unacceptable enumerated value was passed to a function.
- IL_OUT_OF_MEMORY, ILU_OUT_OF_MEMORY, ILUT_OUT_OF_MEMORY
- Could not allocate enough memory in an operation.
- The format a function tried to use was not able to be used by that function.
- IL_INTERNAL_ERROR, ILU_INTERNAL_ERROR
- A serious error has occurred. Please e-mail DooMWiz with the conditions leading up to this error being reported.
- IL_INVALID_VALUE, ILU_INVALID_VALUE, ILUT_INVALID_VALUE
- An invalid value was passed to a function or was in a file.
- IL_ILLEGAL_OPERATION, ILU_ILLEGAL_OPERATION, ILUT_ILLEGAL_OPERATION
- The operation attempted is not allowable in the current state. The function returns with no ill side effects.
- An illegal value was found in a file trying to be loaded.
- A file's header was incorrect.
- IL_INVALID_PARAM, ILU_INVALID_PARAM, ILUT_INVALID_PARAM
- An invalid parameter was passed to a function, such as a NULL pointer.
- IL_COULD_NOT_OPEN_FILE, ILUT_COULD_NOT_OPEN_FILE
- Could not open the file specified. The file may already be open by another app or may not exist.
- The extension of the specified filename was not correct for the type of image-loading function.
- The filename specified already belongs to another file. To overwrite files by default, call ilEnable with the IL_FILE_OVERWRITE parameter.
- Tried to convert an image from its format to the same format.
- IL_STACK_OVERFLOW, ILUT_STACK_OVERFLOW
- One of the internal stacks was already filled, and the user tried to add on to the full stack.
- IL_STACK_UNDERFLOW, ILUT_STACK_UNDERFLOW
- One of the internal stacks was empty, and the user tried to empty the already empty stack.
- An invalid conversion attempt was tried.
- An error occurred in the libjpeg library.
- An error occurred in the libpng library.
- No function sets this yet, but it is possible (not probable) it may be used in the future.
- A type is valid but not supported in the current build.