Next: , Previous: Compound Pre-Scheme data manipulation, Up: Standard Pre-Scheme environment


9.3.5 Error handling

Pre-Scheme's method of error handling is similar to the most common one in C: error codes. There is an enumeration errors of some error codes commonly and portably encountered in Pre-Scheme.

— enumeration: errors
          (define-enumeration errors
            (no-errors
             parse-error
             file-not-found
             out-of-memory
             invalid-port))

Each enumerand has the following meaning:

(enum errors no-errors)
Absence of error: success.
(enum errors parse-error)
Any kind of parsing error. The Scheme48 VM uses this when someone attempts to resume a malformed suspended heap image.
(enum errors file-not-found)
Used when an operation that operates on a file given a string filename found that the file for that filename was absent.
(enum errors out-of-memory)
When there is no more memory to allocate.
(enum errors invalid-port)
Unused.

— procedure: error-string error-status –> string

Returns a string describing the meaning of the errors enumerand error-status.

— procedure: error message irritant ...

Signals a fatal error with the given message & related irritants and halts the program. On Unix, the program's exit code is -1.