Log exceptions that happen during service call (#11394)

* Log exceptions that happen during service call

* Lint
This commit is contained in:
Paulus Schoutsen 2018-01-01 15:32:39 -08:00 committed by GitHub
parent cb899a9465
commit 1b4be0460c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1024,6 +1024,7 @@ class ServiceRegistry(object):
service_call = ServiceCall(domain, service, service_data, call_id)
try:
if service_handler.is_callback:
service_handler.func(service_call)
fire_service_executed()
@ -1036,7 +1037,9 @@ class ServiceRegistry(object):
service_handler.func(service_call)
fire_service_executed()
self._hass.async_add_job(execute_service)
yield from self._hass.async_add_job(execute_service)
except Exception: # pylint: disable=broad-except
_LOGGER.exception('Error executing service %s', service_call)
class Config(object):