2016-03-08 00:06:04 +01:00
|
|
|
"""Exceptions used by Home Assistant."""
|
2015-08-30 03:11:24 +02:00
|
|
|
|
2015-08-30 04:34:35 +02:00
|
|
|
|
2015-08-30 03:11:24 +02:00
|
|
|
class HomeAssistantError(Exception):
|
2016-03-08 00:06:04 +01:00
|
|
|
"""General Home Assistant exception occurred."""
|
|
|
|
|
2015-08-30 03:11:24 +02:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class InvalidEntityFormatError(HomeAssistantError):
|
2016-03-08 00:06:04 +01:00
|
|
|
"""When an invalid formatted entity is encountered."""
|
|
|
|
|
2015-08-30 03:11:24 +02:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class NoEntitySpecifiedError(HomeAssistantError):
|
2016-03-08 00:06:04 +01:00
|
|
|
"""When no entity is specified."""
|
|
|
|
|
2015-08-30 03:11:24 +02:00
|
|
|
pass
|
2015-12-12 04:07:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
class TemplateError(HomeAssistantError):
|
2016-03-08 00:06:04 +01:00
|
|
|
"""Error during template rendering."""
|
|
|
|
|
2015-12-12 04:07:03 +01:00
|
|
|
def __init__(self, exception):
|
2016-03-08 00:06:04 +01:00
|
|
|
"""Initalize the error."""
|
2015-12-12 04:07:03 +01:00
|
|
|
super().__init__('{}: {}'.format(exception.__class__.__name__,
|
|
|
|
exception))
|