Source code for mcparser.corpus.errors

"""Exceptions raised by the corpus layer.

Every exception derives from :class:`CorpusError` so that callers (e.g. the MCP
server) can turn any expected failure into a message for the model.
"""

from __future__ import annotations


[docs] class CorpusError(Exception): """Base class for all expected corpus failures."""
[docs] class ConlluFormatError(CorpusError): """The CoNLL-U text could not be parsed."""
[docs] class NotFoundError(CorpusError): """A source, sentence, token or flag does not exist."""
[docs] class ReadOnlyError(CorpusError): """An edit was attempted on a read-only source."""
[docs] class ConflictError(CorpusError): """The file on disk changed since it was loaded."""
[docs] class EditError(CorpusError): """An edit was rejected because its arguments are invalid."""