#NEWLINE# def __init__( self , message = None , **kwargs ) : #NEWLINE# #INDENT# self . kwargs = kwargs #NEWLINE# if ( not message ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# message = ( self . msg_fmt % kwargs ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# exc_info = sys . exc_info ( ) #NEWLINE# LOG . exception ( _ ( 'Exception in string format operation for %s exception' ) , self . __class__ . __name__ ) #NEWLINE# for ( name , value ) in six . iteritems ( kwargs ) : #NEWLINE# #INDENT# LOG . error ( ( '%s: %s' % ( kwargs , value ) ) ) #NEWLINE# #UNINDENT# if CONF . fatal_exception_format_errors : #NEWLINE# #INDENT# six . reraise ( * exc_info ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# message = self . msg_fmt #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( not isinstance ( message , six . string_types ) ) : #NEWLINE# #INDENT# LOG . error ( _ ( "Message '%(msg)s' for %(ex)s exception is not a string" ) , { #NEWLINE# #INDENT# 'msg' : message , #NEWLINE# 'ex' : self . __class__ . __name__ , #NEWLINE# #UNINDENT# } ) #NEWLINE# if CONF . fatal_exception_format_errors : #NEWLINE# #INDENT# raise TypeError ( _ ( 'Invalid exception message format' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# message = self . msg_fmt #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# super ( EC2APIException , self ) . __init__ ( message )