MCPcopy Create free account
hub / github.com/ipython/ipython / catch_format_error

Function catch_format_error

IPython/core/formatters.py:221–236  ·  view source on GitHub ↗

show traceback on failed format call

(method, self, *args, **kwargs)

Source from the content-addressed store, hash-verified

219
220@decorator
221def catch_format_error(method, self, *args, **kwargs):
222 """show traceback on failed format call"""
223 try:
224 r = method(self, *args, **kwargs)
225 except NotImplementedError:
226 # don't warn on NotImplementedErrors
227 return self._check_return(None, args[0])
228 except Exception:
229 exc_info = sys.exc_info()
230 ip = get_ipython()
231 if ip is not None:
232 ip.showtraceback(exc_info)
233 else:
234 traceback.print_exception(*exc_info)
235 return self._check_return(None, args[0])
236 return self._check_return(r, args[0])
237
238
239class FormatterABC(metaclass=abc.ABCMeta):

Callers

nothing calls this directly

Calls 3

showtracebackMethod · 0.80
get_ipythonFunction · 0.70
_check_returnMethod · 0.45

Tested by

no test coverage detected