from .strings import ERR_DOCUMENT_EXTENT_MISSING
[docs]class ComponentCompatError(TypeError):
pass
[docs]class DataCompatError(TypeError):
pass
[docs]class DocumentNotLoadedError(Exception):
pass
[docs]class XMLParsingFailed(Exception):
pass
[docs]class SemanticValidationError(Exception):
pass
[docs]class EndOfData(Exception):
pass
[docs]class IncompatibleSequenceError(Exception):
pass
[docs]class SequenceNumberCollisionError(IncompatibleSequenceError):
pass
[docs]class DocumentDiscardedError(Exception):
offending_document = None
[docs]class SequenceOverridden(Exception):
pass
[docs]class LogicError(Exception):
pass
[docs]class ExtentMissingError(Exception):
_attribute = None
def __init__(self, attribute):
self._attribute = attribute
def __str__(self):
return ERR_DOCUMENT_EXTENT_MISSING.format(type=type(self._attribute), value=self._attribute)
[docs]class StopBranchIteration(Exception):
"""
Let the iterator know that it can proceed to the next branch. It does not need to traverse the current one any
further.
"""
[docs]class OutsideSegmentError(StopBranchIteration):
"""
This exception is meant to be raised by the copying functionality to make the iterator know that a particular
subtree is not meant to be parsed.
"""
[docs]class DiscardElement(Exception):
"""
There is a possibility that an element may become superfluous or lose its value. Such a possibility can happen
in segmentation when a p element gets selected because it contains 2 spans but the segment happens to be selecting
an interval between them so the container ends up being empty and thus should be discarded.
"""
[docs]class ConfigurationError(Exception):
pass
[docs]class UnexpectedSequenceIdentifierError(Exception):
pass
[docs]class UnexpectedAuthorsGroupError(Exception):
pass