Catch exceptions when error rendering templates

This commit is contained in:
Paulus Schoutsen 2015-12-11 19:07:03 -08:00
parent 5c63862054
commit b1bf6a609e
3 changed files with 28 additions and 5 deletions

View file

@ -14,3 +14,10 @@ class InvalidEntityFormatError(HomeAssistantError):
class NoEntitySpecifiedError(HomeAssistantError):
""" When no entity is specified. """
pass
class TemplateError(HomeAssistantError):
""" Error during template rendering. """
def __init__(self, exception):
super().__init__('{}: {}'.format(exception.__class__.__name__,
exception))