next up previous contents index
Next: 11.3 Convenience Predicates Up: 11.2 Predicates to Throw Previous: 11.2.1 Predicates to Throw   Contents   Index

11.2.2 Predicates to Handle Errors

catch(?Goal,?CatchTerm,+Handler)

Calls Goal, and sets up information so that future throws will be able to access CatchTerm under the mechanism mentioned above. catch/3 does not attempt to clean up system level resources. Thus, it is left up to the handler to close open tables (via close_open_tables/0, close any open files, reset current input and output, and so on 11.4.
default_user_error_handler(?CatchTerm)

Handles any error terms that unify with CatchTerm that are not caught by invocations of catch/3. This predicate does close open tables and release mutexes held by the calling thread, but does not attempt to clean up other system level resources, which is left to the handler.
error_write(?Message)
standard

error_writeln(?Message)
standard

Utility routines for user-defined error catching. These predicates output Message to XSB's STDERR stream, rather than to XSB's STDOUT stream, as does write/1 and writeln/1. In addition, if Message is a comma list, the elements in the comma list are output as if they were concatenated together. Each of these predicates must be implicitly imported from the module standard.

close_open_tables
machine
Removes table data structures for all incomplete tables, but does not affect any incomplete tables. In Version 3.0 this predicate should only be used to handle exceptions in default_user_error_handler/1. In addition, for the multi-threaded engine, this predicate unlocks any system mutexes held by the thread calling this predicate.


next up previous contents index
Next: 11.3 Convenience Predicates Up: 11.2 Predicates to Throw Previous: 11.2.1 Predicates to Throw   Contents   Index
Terrance Swift 2007-10-05