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

Method format_exception

IPython/core/ultratb.py:1118–1130  ·  view source on GitHub ↗
(self, etype, evalue)

Source from the content-addressed store, hash-verified

1116 return head
1117
1118 def format_exception(self, etype, evalue):
1119 colors = self.Colors # just a shorthand + quicker name lookup
1120 colorsnormal = colors.Normal # used a lot
1121 # Get (safely) a string form of the exception info
1122 try:
1123 etype_str, evalue_str = map(str, (etype, evalue))
1124 except:
1125 # User exception is improperly defined.
1126 etype, evalue = str, sys.exc_info()[:2]
1127 etype_str, evalue_str = map(str, (etype, evalue))
1128 # ... and format it
1129 return ['%s%s%s: %s' % (colors.excName, etype_str,
1130 colorsnormal, py3compat.cast_unicode(evalue_str))]
1131
1132 def format_exception_as_a_whole(self, etype, evalue, etb, number_of_lines_of_context, tb_offset):
1133 """Formats the header, traceback and exception message for a single exception.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected