SDK ERROR()

From Recital Documentation Wiki
Revision as of 12:09, 30 March 2009 by Yvonnemilne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

PURPOSE

Used to define and signal a user-defined error


SYNONYM

api_error()


SYNOPSIS

#include "dbapi.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 Recital 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 Recital program:

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

Example 'C' function:

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


SEE ALSO

COMMAND()