add error handling

This commit is contained in:
Pascal Vizeli
2016-10-04 22:15:41 +02:00
parent 07c709abf4
commit 0af05d178b

View File

@@ -167,15 +167,22 @@ class HomeAssistant(object):
) )
# Setup signal handling # Setup signal handling
if sys.platform != "win32": if sys.platform != 'win32':
self.loop.add_signal_handler( try:
signal.SIGTERM, self.loop.add_signal_handler(
stop_homeassistant signal.SIGTERM,
) stop_homeassistant
self.loop.add_signal_handler( )
signal.SIGHUP, except ValueError:
restart_homeassistant _LOGGER.warning('Could not bind to SIGTERM.')
)
try:
self.loop.add_signal_handler(
signal.SIGHUP,
restart_homeassistant
)
except ValueError:
_LOGGER.warning('Could not bind to SIGHUP.')
# Run forever and catch keyboard interrupt # Run forever and catch keyboard interrupt
try: try: