h6. [[TrapError]] h6(. » Technical Details h2. TrapError Technical Details The TrapError module adds a routine onto the error vector ([[ErrorV]]) which will test the error number of any errors generated against a list of error numbers. If an error is generated which matches an entry in the list, TrapError will do one of several possible things: * Call [[OS_Reset]] to reboot the machine * Claim the error so it doesn't get passed-on * Branch to some code routine This depends on the action specified for each error number. The default action can be altered after an error number has been added to the list. The default state of the module is *on*. The default table (list) of error numbers to trap is *empty*. h3. Debugging The debug build of this module will output a dump of all errors passing through the error vector to a file. This file can be specified by setting the system variable <CODE><TrapError$File></CODE>. While this variable is not set, no dump output will be generated. If the file specified already exists, the debug output will be appended at the end. If a directory exists with the same name as the file specified, no error message or debug output will be generated. The debug output consists of lines of the following format (all values are eight-digit hexadecimal): <pre> <Monotonic time of error> <space> <Error number> <space> <Error text> <linefeed> </pre> h4. Table Format |_<^{width:4em}. Word |_<^. Meaning | |<^. 0 |<^. Lowest error number in list - 1 | |<^. 1 |<^. Highest error number in list + 1 | |<^. 2 |<^. Error number | |<^. 3 |<^. Action to take | |<^. 4 |<^. Value to pass in R12 | |<^. 6 |<^. Error number | |<^. ... |<^. ... | |<^. n |<^. 0 (end of list) | When the table is empty, word 0 contains &7FFFFFFF and word 1 contains &C0000000. This will allow very quick detection of when an error number should not be checked and thus be passed on. Every time a number is removed from the table, it is compared against words 0 and 1 (-1). If it matches either (or both), the table will be re-scanned to get the next lowest/highest. h3. Overview of TrapError *Commands The TrapError module provides a *Command equivalent to each SWI, with the same name and the same parameters. The only difference of note is that all *Commands which would have a flags parameter which should be zero, have that parameter omitted. For example, [[*TrapError_Off]] takes no parameters. Use *Help for more information