Skip to content

Commit 61eb149

Browse files
committed
Add traceback to service response #35
1 parent 9c25ba6 commit 61eb149

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

custom_components/python_script/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import hashlib
22
import logging
3+
import traceback
34

45
import voluptuous as vol
56
from homeassistant.core import (
@@ -110,7 +111,7 @@ def execute_script(hass, data, context, logger, code) -> ServiceResponse:
110111
return response
111112
except Exception as e:
112113
_LOGGER.error(f"Error executing script", exc_info=e)
113-
return {"error": str(e)}
114+
return {"error": str(e), "traceback": "".join(traceback.format_exception(e))}
114115

115116

116117
def simple_type(value) -> bool:

0 commit comments

Comments
 (0)