#NEWLINE# def _process_async_error( self , resp_body , error_class ) : #NEWLINE# #INDENT# '\n        The DNS API does not return a consistent format for their error\n        messages. This abstracts out the differences in order to present\n        a single unified message in the exception to be raised.\n        ' #NEWLINE# def _fmt_error( err ) : #NEWLINE# #INDENT# details = err . get ( 'details' , '' ) . replace ( '\n' , ' ' ) #NEWLINE# if ( not details ) : #NEWLINE# #INDENT# details = err . get ( 'message' , '' ) #NEWLINE# #UNINDENT# return ( '%s (%s)' % ( details , err . get ( 'code' , '' ) ) ) #NEWLINE# #UNINDENT# error = resp_body . get ( 'error' , '' ) #NEWLINE# if ( 'failedItems' in error ) : #NEWLINE# #INDENT# faults = error . get ( 'failedItems' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) . get ( 'faults' , [ ] ) #NEWLINE# msgs = [ _fmt_error ( fault ) for fault in faults ] #NEWLINE# msg = '\n' . join ( msgs ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msg = _fmt_error ( error ) #NEWLINE# #UNINDENT# raise error_class ( msg )