Skip to content

Commit 4c7fab3

Browse files
IceCreamDebugger ignores exceptions
1 parent fc40981 commit 4c7fab3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

icecream/icecream.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from contextlib import contextmanager
2424
from os.path import basename, realpath
2525
from textwrap import dedent
26+
import traceback
2627

2728
import colorama
2829
import executing
@@ -208,8 +209,11 @@ def __init__(self, prefix=DEFAULT_PREFIX,
208209

209210
def __call__(self, *args):
210211
if self.enabled:
211-
callFrame = inspect.currentframe().f_back
212-
self.outputFunction(self._format(callFrame, *args))
212+
try:
213+
callFrame = inspect.currentframe().f_back
214+
self.outputFunction(self._format(callFrame, *args))
215+
except:
216+
print(f"IceCreamDebugger: exception ignored:\n\n {traceback.format_exc()}", sys.stderr)
213217

214218
if not args: # E.g. ic().
215219
passthrough = None

0 commit comments

Comments
 (0)