Skip to content

BlockNotFoundError

Base classes

Name Children Inherits
Exception
builtins
Common base class for all non-exit exceptions.

⋔ Inheritance diagram

graph TD
  97041654537408["environment.BlockNotFoundError"]
  128674496986464["builtins.Exception"]
  128674496987328["builtins.BaseException"]
  128674497047040["builtins.object"]
  128674496986464 --> 97041654537408
  128674496987328 --> 128674496986464
  128674497047040 --> 128674496987328

🛈 DocStrings

Bases: Exception

Exception for not-found template blocks.

Source code in src/jinjarope/environment.py
class BlockNotFoundError(Exception):
    """Exception for not-found template blocks."""

    def __init__(
        self,
        block_name: str,
        template_name: str,
        message: str | None = None,
    ) -> None:
        """Initialize the exception."""
        self.block_name = block_name
        self.template_name = template_name
        super().__init__(
            message or f"Block {self.block_name!r} not found in template {self.template_name!r}",
        )

__init__

__init__(block_name: str, template_name: str, message: str | None = None) -> None

Initialize the exception.

Source code in src/jinjarope/environment.py
def __init__(
    self,
    block_name: str,
    template_name: str,
    message: str | None = None,
) -> None:
    """Initialize the exception."""
    self.block_name = block_name
    self.template_name = template_name
    super().__init__(
        message or f"Block {self.block_name!r} not found in template {self.template_name!r}",
    )

:fa-brands-github: Show source on GitHub