To get the text description of an error code returned by a Side API function, the following function can be used.
This function returns the text description of Side API error code err.
For invalid error codes, the string
"(invalid error code)" is returned.
An interaction side can have an error handler assigned to it.
Such error handler is a function called in the case of raising an error by any Side API function that takes an argument of type
qsmm_side_t equal to the handle of the side and can return an error code.
The default error handler function of an interaction side prints information on an error occurred to
stderr and calls
If there is no error handler function assigned to an interaction side or such a function assigned to the side does not terminate program execution and returns, then a Side API function that has raised the error will return a corresponding error code.
To get or set an error handler for an interaction side, the following functions can be used.
This function retrieves information on an error handler assigned to interaction side.
If func_p is not
NULL, then *func_p will be set to the pointer to the error handler function or
NULL if there is no error handler function assigned to the interaction side.
If param_pp is not
NULL, then *param_pp will be set to the user parameter of the error handler function.
This function assigns an error handler to interaction side.
Argument func specifies the error handler function.
Argument paramp specifies the user parameter of that function.
If func is
NULL, then no error handler will be used for the interaction side.
The type of the pointer to an error handler function is described below.
This is the type of the pointer to an error handler function of interaction side. The following declaration corresponds to this type:
typedef void (*qsmm_side_err_handler_func_t)( qsmm_side_t side, struct qsmm_side_except_s *except_p, void *paramp );
The handle of an interaction side associated with an error occurred is held in side.
This handle was passed to a Side API function that has raised the error.
Information on the error is passed via argument except_p.
Although pointer except_p is not declared with the
const qualifier, the error handler should not modify *except_p.
A user parameter specified when setting the error handler function for the interaction side is passed via argument paramp.
A structure that contains information on an error occurred is described below.
This structure conveys information about an error occurred to the error handler function of an interaction side associated with the error. The structure contains the following fields.
The name of a function where the error has occurred. This function can be a failed Side API function or any function within the QSMM library called while executing the failed function. That failed function did acquire an argument equal to the handle of the interaction side associated with the error.
An error code that would be returned by a failed Side API function after return from the error handler function.