SPP Reference Manual


The SPP language provides two facilities for
error handling (see Table 3.1).

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.

Table 3.1: - Error Handlers in SPP.
Additional Error Handling Procedures
Error Handlers

Generated with CERN WebMaker