RenderWare V2.1

Previous Page Index Next Page

Error Reporting


RenderWare reports errors by setting a global error status. The majority of API functions have a distinguished return value which indicates that the global error status has been set by that function.

The global error status may be interrogated by RwGetError(). This returns E_RW_NOERROR if no error has occurred. Otherwise, an error code is returned representing the first error encountered since the global error status was last cleared. The global error code is cleared to E_RW_NOERROR by calling RwGetError().

The global error status is set when an error occurs and the global error status is E_RW_NOERROR. The actual error code set indicates the type of the error. Once set, the error status is not set by any subsequent error until RwGetError() is called. This ensures that the first error encountered is not over written by subsequent errors

As previously described, the majority of API functions have a distinguished return value which indicates that the global error status has been set by that function. However, there are functions where this is not possible. For example, the function RwGetClumpParent() can return NULL as a legal value (when the clump is the root of a hierarchy). The documentation for any such function directs the application to call RwGetError() to determine whether an error occurred.

It is strongly recommend that application programs test the return values of library functions to check for errors. This is particularly important in the case of RenderWare’s constructor functions such as RwCreateMatrix() or RwCreateCamera().

The range of error codes that may be returned by RwGetError() is given in Appendix C. RenderWare does not include descriptive strings for each error type. Therefore, to determine the nature of an error it may be necessary to convert a numeric error code into a description. Appendix C contains a table which maps numeric error codes to error identifiers. Furthermore, when using the RenderWare debugging kernel, texture messages for each error generated are issued to the debugging stream. This can be extremely useful in tracking down errors.

Finally, note that application programs may set RenderWare’s global error status using RwSetUserError(). This signals that an error was encountered in an application supplied call back function. Its primary function is to prematurely terminate the iteration performed by one of RenderWare’s RwForAll...() functions.