Next: , Previous: , Up: API Basics   [Contents][Index]


1.10.4 Error Handling

If an API function returns a value of int type, then a negative return value is an error code. Zero and positive return values indicate additional information regarding a successful completion of a function call.

If an API function does not return a value of int type, the function may not return an error code, because error condition cannot arise within the function, or, at least, because there was such assumption when the function first appeared in the API.

If not otherwise noted in the description of an error code of an API function, returning the error code by the function means that the state of QSMM framework remained unchanged, that is, just after calling the function, the framework retained its state it had just before calling the function.

Use the following API function from the header file err.h (included in qsmm.h) to get the text description of an error code.

Function: const char * qsmm_err_str (int err)

This function returns the text description of API error code err. For invalid error codes, the function returns ‘?’.

When you are creating a multinode model, you can associate an error handler with the model. In this case, the error handler may receive extended information about an error occurred. The use of an error handler may eliminate the need to check the return codes of calls to API functions that have an argument of qsmm_t type to determine whether or not those functions succeeded. See Error Handling for a Multinode Model, for information on using error handlers.


Next: , Previous: , Up: API Basics   [Contents][Index]