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