Symisc Systems

Libcox C/C++ API Reference - Throw an error message

Star Follow @symisc


int libcox_context_throw_error(libcox_context *pCtx,int iErr,const char *zErr);

int libcox_context_throw_error_format(libcox_context *pCtx,int iErr,const char *zFormat,...);

Throw an error message inside a user installed command.


These routines when invoked throw an error message inside a user installed command to the internal error log.

Note that libcox_context_throw_error() accepts a third argument which is the length of the string to output. If the nLen argument is less than zero, then zString is read up to the first zero terminator. If nLen is non-negative, then it is the maximum number of bytes read from zString.

libcox_context_throw_error_format() is a work-alike of the "printf()" family of functions from the standard C library which is used to output a formatted string.

These routines accepts as their first argument a pointer to a libcox_context which mean that they are designed to be invoked only from a foreign command.

These routines must be called from the same thread in which the application-defined function is running.



Foreign command call context.


Severity level. This can be one of the following constants (Not a combination):
Call context error such as: An unexpected number of arguments, invalid types and so forth.
Call context warning.
Call context notice.

Return value

LIBCOX_OK is returned on success. Any other return value indicates failure.

See also