Next: , Previous: Directories, Up: Top


14 Exceptions

This section describes the standard format for exceptions. We strongly encourage all developers to adhere to this format, for two main reasons:

A typical exception from the XDK looks is a record with label error1, and features 'functor', 'proc', info, msg, coord and file. The latter three features are obligatory, the others optional. The obligatory features are always printed out by the error handling procedures of the executables pertaining to the XDK. The other features are typically only to be seen when the debug mode is on.

Here is an example exception:

     error1('functor':'Compiler/TypeCollector.ozf'
            'proc':'CollectTypes1'
            info:o(AttrsType 'dimension')
            msg:'Attributes type must be a record.'
            coord:AttrsCoord
            file:AttrsFile)

The value of 'functor' must be an atom representing the path to the functor in which the exception was raised.

The value of 'proc' must be an atom representing the name of the procedure in which the exception was raised.

The value of info is a tuple with label o with arbitrary projections providing extra information (in addition to the message, see below) for debugging purposes.

The value of msg is a virtual string representing the message to be printed by the error handling procedures.

The value of coord is either the atom noCoord, a pair I1#I2 of two integers I1 and I2, or just an integer I, denoting the range of lines or just the line of an error which occurred when compiling a grammar file.

The value of file is either the atom noFile, or an atom A denoting the filename of the grammar file where the error occurred.