Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IceCreamDebugger now ignores exceptions in formatting #152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions icecream/icecream.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from contextlib import contextmanager
from os.path import basename, realpath
from textwrap import dedent
import traceback

import colorama
import executing
Expand Down Expand Up @@ -208,8 +209,11 @@ def __init__(self, prefix=DEFAULT_PREFIX,

def __call__(self, *args):
if self.enabled:
callFrame = inspect.currentframe().f_back
self.outputFunction(self._format(callFrame, *args))
try:
callFrame = inspect.currentframe().f_back
self.outputFunction(self._format(callFrame, *args))
except:
print(f"IceCreamDebugger: exception ignored:\n\n{traceback.format_exc()}", sys.stderr)

if not args: # E.g. ic().
passthrough = None
Expand Down