Module gender_render.errors

Custom error types, as defined by the gender*render specification.

Please note that, since gender*render is intended to be used on human input rather than machine-generated input (templates are written by people, after all), the error hierarchy might change irregularly, and should not necessarily be relied on.

Expand source code Browse git
"""Custom error types, as defined by the gender*render specification.

Please note that, since gender\\*render is intended to be used on human input rather than machine-generated input
(templates are written by people, after all), the error hierarchy might change irregularly, and should not
necessarily be relied on."""

# Invalid Template:


class SyntaxError(SyntaxError):
    """Raised when an error occurs whilst parsing a gender*render template."""
    pass


class SyntaxPostprocessingError(SyntaxError):
    """A more specific type of SyntaxError that is raised when errors occur in template parsing outside of the rules set
    by the finite state machine."""
    pass


class InvalidCapitalizationError(SyntaxPostprocessingError):
    """Raised when the capitalization of a context value or the capitalization value of a tag are invalid."""
    pass


# Invalid Pronoun Data:


class InvalidPDError(Exception):
    """Raised when a piece of invalid pronoun data is given to a function that expects valid pronoun data."""
    pass


class DoubledInformationError(InvalidPDError):
    """Raised when a piece of individual pronoun data contains two different properties for the same attribute."""
    pass


class InvalidInformationError(InvalidPDError):
    """Raised when an attribute in a piece of individual pronoun data has an invalid value assigned.
    This error is only used for attributes that only allow a fixed set of values."""
    pass

# Errors during rendering:


class RenderingError(Exception):
    """Raised when something goes wrong during the rendering process. This exception is never raised directly,
    but can be caught to catch any type of error that arises during rendering due to the exception hierarchy."""
    pass


class IdResolutionError(RenderingError):
    """Raised when id resolution fails due to template and pronoun data not matching."""
    pass


class MissingInformationError(RenderingError):
    """Raised when a piece of individual pronoun data does not contain an attribute requested by the renderer."""

Classes

class SyntaxError (*args, **kwargs)

Raised when an error occurs whilst parsing a gender*render template.

Expand source code Browse git
class SyntaxError(SyntaxError):
    """Raised when an error occurs whilst parsing a gender*render template."""
    pass

Ancestors

  • builtins.SyntaxError
  • builtins.Exception
  • builtins.BaseException

Subclasses

class SyntaxPostprocessingError (*args, **kwargs)

A more specific type of SyntaxError that is raised when errors occur in template parsing outside of the rules set by the finite state machine.

Expand source code Browse git
class SyntaxPostprocessingError(SyntaxError):
    """A more specific type of SyntaxError that is raised when errors occur in template parsing outside of the rules set
    by the finite state machine."""
    pass

Ancestors

  • SyntaxError
  • builtins.SyntaxError
  • builtins.Exception
  • builtins.BaseException

Subclasses

class InvalidCapitalizationError (*args, **kwargs)

Raised when the capitalization of a context value or the capitalization value of a tag are invalid.

Expand source code Browse git
class InvalidCapitalizationError(SyntaxPostprocessingError):
    """Raised when the capitalization of a context value or the capitalization value of a tag are invalid."""
    pass

Ancestors

class InvalidPDError (*args, **kwargs)

Raised when a piece of invalid pronoun data is given to a function that expects valid pronoun data.

Expand source code Browse git
class InvalidPDError(Exception):
    """Raised when a piece of invalid pronoun data is given to a function that expects valid pronoun data."""
    pass

Ancestors

  • builtins.Exception
  • builtins.BaseException

Subclasses

class DoubledInformationError (*args, **kwargs)

Raised when a piece of individual pronoun data contains two different properties for the same attribute.

Expand source code Browse git
class DoubledInformationError(InvalidPDError):
    """Raised when a piece of individual pronoun data contains two different properties for the same attribute."""
    pass

Ancestors

class InvalidInformationError (*args, **kwargs)

Raised when an attribute in a piece of individual pronoun data has an invalid value assigned. This error is only used for attributes that only allow a fixed set of values.

Expand source code Browse git
class InvalidInformationError(InvalidPDError):
    """Raised when an attribute in a piece of individual pronoun data has an invalid value assigned.
    This error is only used for attributes that only allow a fixed set of values."""
    pass

Ancestors

class RenderingError (*args, **kwargs)

Raised when something goes wrong during the rendering process. This exception is never raised directly, but can be caught to catch any type of error that arises during rendering due to the exception hierarchy.

Expand source code Browse git
class RenderingError(Exception):
    """Raised when something goes wrong during the rendering process. This exception is never raised directly,
    but can be caught to catch any type of error that arises during rendering due to the exception hierarchy."""
    pass

Ancestors

  • builtins.Exception
  • builtins.BaseException

Subclasses

class IdResolutionError (*args, **kwargs)

Raised when id resolution fails due to template and pronoun data not matching.

Expand source code Browse git
class IdResolutionError(RenderingError):
    """Raised when id resolution fails due to template and pronoun data not matching."""
    pass

Ancestors

class MissingInformationError (*args, **kwargs)

Raised when a piece of individual pronoun data does not contain an attribute requested by the renderer.

Expand source code Browse git
class MissingInformationError(RenderingError):
    """Raised when a piece of individual pronoun data does not contain an attribute requested by the renderer."""

Ancestors