Skip to content

Commit d1ddf37

Browse files
committed
full traceback for debug level
1 parent cbb2f44 commit d1ddf37

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

custom_components/pyscript/eval.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import logging
1313
import sys
1414
import time
15+
import traceback
1516
import weakref
1617

1718
import yaml
@@ -2197,11 +2198,9 @@ def format_exc(self, exc, lineno=None, col_offset=None, short=False, code_list=N
21972198
else:
21982199
mesg = f"Exception in <{self.filename}>:\n"
21992200
mesg += f"{type(exc).__name__}: {exc}"
2200-
#
2201-
# to get a more detailed traceback on exception (eg, when chasing an internal
2202-
# error), add an "import traceback" above, and uncomment this next line
2203-
#
2204-
# return mesg + "\n" + traceback.format_exc(-1)
2201+
2202+
if _LOGGER.isEnabledFor(logging.DEBUG):
2203+
mesg += "\n" + traceback.format_exc()
22052204
return mesg
22062205

22072206
def get_exception(self):

0 commit comments

Comments
 (0)