Ensure all template errors are caught and the websocket api reports them (#41719)
This commit is contained in:
parent
f7e7f1371e
commit
b897ca7260
5 changed files with 61 additions and 11 deletions
|
@ -1,8 +1,6 @@
|
|||
"""The exceptions used by Home Assistant."""
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
|
||||
import jinja2
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .core import Context # noqa: F401 pylint: disable=unused-import
|
||||
|
||||
|
@ -22,7 +20,7 @@ class NoEntitySpecifiedError(HomeAssistantError):
|
|||
class TemplateError(HomeAssistantError):
|
||||
"""Error during template rendering."""
|
||||
|
||||
def __init__(self, exception: jinja2.TemplateError) -> None:
|
||||
def __init__(self, exception: Exception) -> None:
|
||||
"""Init the error."""
|
||||
super().__init__(f"{exception.__class__.__name__}: {exception}")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue