SDK ERROR()

From Lianjapedia
Jump to: navigation, search

PURPOSE

Used to define and signal a user-defined error

SYNONYM

api_error()

SYNOPSIS

#include "lianja_api.h"
 
void	ERROR(number, message)
 
<input parameters>
int	number;		/* Error number						*/
char	*message;		/* Address of a buffer containing error message	*/
 
<output parameters>
none

DESCRIPTION

The ERROR() function is used to define and signal a user-defined error. When the ERROR() function is called, a run-time error occurs and the current error handler will be called. The current error handler is an active ON ERROR <command>, a TRY...CATCH block, or the default error handler which creates an error.mem file.

EXAMPLE

The following example calls the error handler if the wrong number of parameters has been passed.

Example Lianja script:

if pcount() <> 3
  error 10000, "Invalid parameter count"
endif

Example 'C' function:

#include "lianja_api.h"
 
lianjaapi_checkparams()
{
	if (PCOUNT != 3) {
		ERROR(10000, "Invalid parameter count");
	}
}

SEE ALSO

COMMAND()