[Lxml-checkins] r43319 - lxml/trunk/src/lxml
scoder at codespeak.net
scoder at codespeak.net
Sun May 13 20:44:00 CEST 2007
Author: scoder
Date: Sun May 13 20:43:59 2007
New Revision: 43319
Modified:
lxml/trunk/src/lxml/dtd.pxi
lxml/trunk/src/lxml/etree.pyx
lxml/trunk/src/lxml/extensions.pxi
lxml/trunk/src/lxml/nsclasses.pxi
lxml/trunk/src/lxml/parser.pxi
lxml/trunk/src/lxml/relaxng.pxi
lxml/trunk/src/lxml/sax.py
lxml/trunk/src/lxml/schematron.pxi
lxml/trunk/src/lxml/xmlschema.pxi
lxml/trunk/src/lxml/xslt.pxi
Log:
docstrings on exceptions
Modified: lxml/trunk/src/lxml/dtd.pxi
==============================================================================
--- lxml/trunk/src/lxml/dtd.pxi (original)
+++ lxml/trunk/src/lxml/dtd.pxi Sun May 13 20:43:59 2007
@@ -2,12 +2,18 @@
cimport dtdvalid
class DTDError(LxmlError):
+ """Base class for DTD errors.
+ """
pass
class DTDParseError(DTDError):
+ """Error while parsing a DTD.
+ """
pass
class DTDValidateError(DTDError):
+ """Error while validating an XML document with a DTD.
+ """
pass
################################################################################
Modified: lxml/trunk/src/lxml/etree.pyx
==============================================================================
--- lxml/trunk/src/lxml/etree.pyx (original)
+++ lxml/trunk/src/lxml/etree.pyx Sun May 13 20:43:59 2007
@@ -85,6 +85,9 @@
# module level superclass for all exceptions
class LxmlError(Error):
+ """Main exception base class for lxml. All other exceptions inherit from
+ this one.
+ """
def __init__(self, *args):
_initError(self, *args)
self.error_log = __copyGlobalErrorLog()
@@ -106,15 +109,18 @@
# superclass for all syntax errors
class LxmlSyntaxError(LxmlError, SyntaxError):
- pass
-
-class DocumentInvalid(LxmlError):
+ """Base class for all syntax errors.
+ """
pass
class XIncludeError(LxmlError):
+ """Error during XInclude processing.
+ """
pass
class C14NError(LxmlError):
+ """Error during C14N serialisation.
+ """
pass
# version information
@@ -1957,6 +1963,12 @@
################################################################################
# Validation
+class DocumentInvalid(LxmlError):
+ """Validation error. Raised by all document validators when their
+ ``assertValid(tree)`` method fails.
+ """
+ pass
+
cdef class _Validator:
"Base class for XML validators."
cdef _ErrorLog _error_log
Modified: lxml/trunk/src/lxml/extensions.pxi
==============================================================================
--- lxml/trunk/src/lxml/extensions.pxi (original)
+++ lxml/trunk/src/lxml/extensions.pxi Sun May 13 20:43:59 2007
@@ -1,15 +1,23 @@
# support for extension functions in XPath and XSLT
class XPathError(LxmlError):
+ """Base class of all XPath errors.
+ """
pass
class XPathEvalError(XPathError):
+ """Error during XPath evaluation.
+ """
pass
class XPathFunctionError(XPathEvalError):
+ """Internal error looking up an XPath extension function.
+ """
pass
class XPathResultError(XPathEvalError):
+ """Error handling an XPath result.
+ """
pass
# forward declarations
Modified: lxml/trunk/src/lxml/nsclasses.pxi
==============================================================================
--- lxml/trunk/src/lxml/nsclasses.pxi (original)
+++ lxml/trunk/src/lxml/nsclasses.pxi Sun May 13 20:43:59 2007
@@ -1,9 +1,13 @@
# module-level API for namespace implementations
class LxmlRegistryError(LxmlError):
+ """Base class of lxml registry errors.
+ """
pass
class NamespaceRegistryError(LxmlRegistryError):
+ """Error registering a namespace extension.
+ """
pass
cdef object __NAMESPACE_REGISTRIES
Modified: lxml/trunk/src/lxml/parser.pxi
==============================================================================
--- lxml/trunk/src/lxml/parser.pxi (original)
+++ lxml/trunk/src/lxml/parser.pxi Sun May 13 20:43:59 2007
@@ -5,9 +5,13 @@
from xmlparser cimport xmlParserCtxt, xmlDict
class XMLSyntaxError(LxmlSyntaxError):
+ """Syntax error while parsing an XML document.
+ """
pass
class ParserError(LxmlError):
+ """Internal lxml parser error.
+ """
pass
ctypedef enum LxmlParserType:
@@ -378,7 +382,7 @@
raise TypeError, "This class cannot be instantiated"
self._parser_ctxt = pctxt
if pctxt is NULL:
- raise ParserError, "Failed to create parser context"
+ python.PyErr_NoMemory()
if pctxt.sax != NULL:
# hard switch-off for CDATA nodes => makes them plain text
pctxt.sax.cdataBlock = NULL
Modified: lxml/trunk/src/lxml/relaxng.pxi
==============================================================================
--- lxml/trunk/src/lxml/relaxng.pxi (original)
+++ lxml/trunk/src/lxml/relaxng.pxi Sun May 13 20:43:59 2007
@@ -2,12 +2,18 @@
cimport relaxng
class RelaxNGError(LxmlError):
+ """Base class for RelaxNG errors.
+ """
pass
class RelaxNGParseError(RelaxNGError):
+ """Error while parsing an XML document as RelaxNG.
+ """
pass
class RelaxNGValidateError(RelaxNGError):
+ """Error while validating an XML document with a RelaxNG schema.
+ """
pass
################################################################################
Modified: lxml/trunk/src/lxml/sax.py
==============================================================================
--- lxml/trunk/src/lxml/sax.py (original)
+++ lxml/trunk/src/lxml/sax.py Sun May 13 20:43:59 2007
@@ -3,6 +3,8 @@
from etree import XML, Comment, ProcessingInstruction
class SaxError(LxmlError):
+ """General SAX error.
+ """
pass
def _getNsTag(tag):
Modified: lxml/trunk/src/lxml/schematron.pxi
==============================================================================
--- lxml/trunk/src/lxml/schematron.pxi (original)
+++ lxml/trunk/src/lxml/schematron.pxi Sun May 13 20:43:59 2007
@@ -48,12 +48,18 @@
"""
class SchematronError(LxmlError):
+ """Base class of all Schematron errors.
+ """
pass
class SchematronParseError(SchematronError):
+ """Error while parsing an XML document as Schematron schema.
+ """
pass
class SchematronValidateError(SchematronError):
+ """Error while validating an XML document with a Schematron schema.
+ """
pass
################################################################################
Modified: lxml/trunk/src/lxml/xmlschema.pxi
==============================================================================
--- lxml/trunk/src/lxml/xmlschema.pxi (original)
+++ lxml/trunk/src/lxml/xmlschema.pxi Sun May 13 20:43:59 2007
@@ -2,12 +2,18 @@
cimport xmlschema
class XMLSchemaError(LxmlError):
+ """Base class of all XML Schema errors
+ """
pass
class XMLSchemaParseError(XMLSchemaError):
+ """Error while parsing an XML document as XML Schema.
+ """
pass
class XMLSchemaValidateError(XMLSchemaError):
+ """Error while validating an XML document with an XML Schema.
+ """
pass
################################################################################
Modified: lxml/trunk/src/lxml/xslt.pxi
==============================================================================
--- lxml/trunk/src/lxml/xslt.pxi (original)
+++ lxml/trunk/src/lxml/xslt.pxi Sun May 13 20:43:59 2007
@@ -3,18 +3,28 @@
cimport xslt
class XSLTError(LxmlError):
+ """Base class of all XSLT errors.
+ """
pass
class XSLTParseError(XSLTError):
+ """Error parsing a stylesheet document.
+ """
pass
class XSLTApplyError(XSLTError):
+ """Error running an XSL transformation.
+ """
pass
class XSLTSaveError(XSLTError):
+ """Error serialising an XSLT result.
+ """
pass
class XSLTExtensionError(XSLTError):
+ """Error registering an XSLT extension.
+ """
pass
# version information
More information about the lxml-checkins
mailing list