Improve zwave_js service error (#79504)

pull/79514/head
Raman Gupta 2022-10-02 17:24:06 -04:00 committed by GitHub
parent 3b794038b1
commit 3a8282d0c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -88,13 +88,14 @@ def raise_exceptions_from_results(
if errors := [
tup for tup in zip(zwave_objects, results) if isinstance(tup[1], Exception)
]:
lines = (
f"{len(errors)} error(s):",
lines = [
*(
f"{zwave_object} - {error.__class__.__name__}: {error.args[0]}"
for zwave_object, error in errors
),
)
)
]
if len(lines) > 1:
lines.insert(0, f"{len(errors)} error(s):")
raise HomeAssistantError("\n".join(lines))