WS: Improve service calling errors (#23840)

* WS: Improve service calling errors

* Docstyle

* Types

* Update text
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2019-05-14 07:09:11 +02:00
1 parent 0d96095646
commit de1fd5a7fa
6 files changed
+68 -8

No files matched your search

+8 -2
View File
@@ -168,8 +168,14 @@ class ScriptEntity(ToggleEntity):
ATTR_NAME: self.script.name,
ATTR_ENTITY_ID: self.entity_id,
}, context=context)
await self.script.async_run(
kwargs.get(ATTR_VARIABLES), context)
try:
await self.script.async_run(
kwargs.get(ATTR_VARIABLES), context)
except Exception as err: # pylint: disable=broad-except
self.script.async_log_exception(
_LOGGER, "Error executing script {}".format(self.entity_id),
err)
raise err
async def async_turn_off(self, **kwargs):
"""Turn script off."""