As of Berkeley DB XML 2.3, the Python API supports a number of exceptions, all derived from XmlException. See examples/python/examples.py for basic usage. The exception classes map to the XmlException::ExceptionCode enumeration in the C++ API, and include: XmlException (parent class) XmlContainerClosed XmlContainerExists XmlContainerOpen XmlDatabaseError XmlDocumentNotFound XmlInvalidValue XmlParserError XmlInternalError XmlVersionMismatch XmlLazyEvaluation XmlNoVariableBinding XmlUnknownIndex XmlQueryEvaluationError XmlQueryParserError XmlEventError XmlContainerNotFound XmlUniqueError XmlNoMemoryError XmlNullPointer XmlTransactionError XmlOperationInterrupted XmlOperationTimeout They have the following properties that may be printed: What (corresponds to XmlException::what() in the C++ API) ExceptionCode (corresponds to XmlException::ExceptionCode in the C++ API) DBError (valid if class is XmlDatabaseError) These next two are valid if class is XmlQueryParserError or XmlQueryEvaluationError, and indicate the location in the query expression that generated the exception: QueryLine QueryColumn