def _format_exception_message(self, exception_type, exception_instance, message_color):
        """Returns a colorized formatted exception message."""
        orig_message_lines = to_unicode(exception_instance).splitlines()

        if len(orig_message_lines) == 0:
            return ''
        exception_message = orig_message_lines[0]

        message_lines = [message_color('   ', termstyle.bold(message_color(exception_type.__name__)), ": ") + message_color(exception_message)]
        for line in orig_message_lines[1:]:
            match = re.match('^---.* begin captured stdout.*----$', line)
            if match:
                message_color = termstyle.magenta
                message_lines.append('')
            line = '   ' + line
            message_lines.append(message_color(line))
        return '\n'.join(message_lines)
def _format_exception_message ( self , exception_type , exception_instance , message_color ) : orig_message_lines = to_unicode ( exception_instance ) . splitlines ( ) if len ( orig_message_lines ) == 0 : return '' exception_message = orig_message_lines [ 0 ] message_lines = [ message_color ( '   ' , termstyle . bold ( message_color ( exception_type . __name__ ) ) , ": " ) + message_color ( exception_message ) ] for line in orig_message_lines [ 1 : ] : match = re . match ( '^---.* begin captured stdout.*----$' , line ) if match : message_color = termstyle . magenta message_lines . append ( '' ) line = '   ' + line message_lines . append ( message_color ( line ) ) return '\n' . join ( message_lines )
Returns a colorized formatted exception message.