next up previous contents index
Next: 5.5 Notes on specific Up: 5. The New XSB-Database Previous: 5.3.2 Querying Databases   Contents   Index

5.4 Error Handling

Each predicate in the XSB-DB interface throws an exception with the functor

   xsb_error(database(Number), Message)
where Number is a string with the error number and Message is a string with a slightly detailed error message. It is upto the user to catch this exception and proceed with error handling. This is done by the throw-catch error handling mechanism in XSB. For example, in order to catch the error which will be thrown when the user attempts to close a database connection for a handle (ha) which does not exist:

| ?- catch(db_disconnect(ha),
     xsb_error(database(Number), Message), handler(Number, Message)).

It is the user's responsibility to define the handler predicate which can be as simple as printing out the error number and message or may involve more complicated processing.

A list of error numbers and messages that are thrown by the XSB-DB interface is given below:


next up previous contents index
Next: 5.5 Notes on specific Up: 5. The New XSB-Database Previous: 5.3.2 Querying Databases   Contents   Index
Terrance Swift 2007-10-06