#NEWLINE# @ classmethod #NEWLINE# def instance( cls , statement , params , orig , dbapi_base_err , connection_invalidated = False , dialect = None ) : #NEWLINE# #INDENT# if ( ( isinstance ( orig , BaseException ) and ( not isinstance ( orig , Exception ) ) ) or isinstance ( orig , DontWrapMixin ) ) : #NEWLINE# #INDENT# return name #NEWLINE# #UNINDENT# if ( orig is not None ) : #NEWLINE# #INDENT# if ( ( not isinstance ( orig , dbapi_base_err ) ) and statement ) : #NEWLINE# #INDENT# return StatementError ( ( '(%s.%s) %s' % ( orig . __class__ . __module__ , orig . __class__ . __name__ , orig ) ) , statement , params , orig ) #NEWLINE# #UNINDENT# glob = globals ( ) #NEWLINE# for super_ in orig . __class__ . __mro__ : #NEWLINE# #INDENT# name = super_ . __name__ #NEWLINE# if dialect : #NEWLINE# #INDENT# name = dialect . dbapi_exception_translation_map . get ( name , name ) #NEWLINE# #UNINDENT# if ( ( name in glob ) and issubclass ( glob [ name ] , DBAPIError ) ) : #NEWLINE# #INDENT# cls = glob [ name ] #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return cls ( statement , params , orig , connection_invalidated )