Table 3.1: Error Handlers in SPP.
An error is signalled by calling the error() procedure. The error() procedure takes two arguments. The first argument is the error number. Application programs that call the error procedure should use an error number between 1 and 500. Numbers above 500 are used for system errors. The error number is used by any code which catches errors to distinguish between the different types of errors. If your application program does not catch errors, the error number is arbitrary. The second argument is the error message. This argument is a string printed on the standard error stream, which is usually connected to the user's terminal. Note that the error message should not contain any newline (\n) characters. The procedure in Example 3.1 demonstrates the use of the error procedure.
There is another procedure with the same arguments as error() named fatal(). The difference between the two procedures is the severity of the error level. Errors which are posted by the fatal() procedure cannot be caught.
Generated with CERN WebMaker