mirror of
https://github.com/home-assistant/core.git
synced 2025-11-05 08:59:57 +00:00
Re-thrown exception occurred in the blocking service call (#21573)
* Rethrown exception occurred in the actual service call * Fix lint and test
This commit is contained in:
committed by
Paulus Schoutsen
parent
cd89809be5
commit
f1b867dccb
@@ -3,7 +3,8 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant.const import MATCH_ALL, EVENT_TIME_CHANGED
|
||||
from homeassistant.core import callback, DOMAIN as HASS_DOMAIN
|
||||
from homeassistant.exceptions import Unauthorized, ServiceNotFound
|
||||
from homeassistant.exceptions import Unauthorized, ServiceNotFound, \
|
||||
HomeAssistantError
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.service import async_get_all_descriptions
|
||||
|
||||
@@ -149,6 +150,12 @@ async def handle_call_service(hass, connection, msg):
|
||||
except ServiceNotFound:
|
||||
connection.send_message(messages.error_message(
|
||||
msg['id'], const.ERR_NOT_FOUND, 'Service not found.'))
|
||||
except HomeAssistantError as err:
|
||||
connection.send_message(messages.error_message(
|
||||
msg['id'], const.ERR_HOME_ASSISTANT_ERROR, '{}'.format(err)))
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
connection.send_message(messages.error_message(
|
||||
msg['id'], const.ERR_UNKNOWN_ERROR, '{}'.format(err)))
|
||||
|
||||
|
||||
@callback
|
||||
|
||||
Reference in New Issue
Block a user