#NEWLINE# def relax_exception( e ) : #NEWLINE# #INDENT# 'Convert HTTPError exception to a Couch specific exception, if possible,\n    or else return the unmodified exception.' #NEWLINE# if isinstance ( e , httpclient . HTTPError ) : #NEWLINE# #INDENT# if ( e . code == 304 ) : #NEWLINE# #INDENT# ce = NotModified ( e ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ce . code == 400 ) : #NEWLINE# #INDENT# ce = BadRequest ( e ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( e . code == 404 ) : #NEWLINE# #INDENT# ce = NotFound ( e ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( e . code == 405 ) : #NEWLINE# #INDENT# ce = MethodNotAllowed ( e ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( e . code == 409 ) : #NEWLINE# #INDENT# ce = Conflict ( e ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( e . code == 412 ) : #NEWLINE# #INDENT# ce = PreconditionFailed ( e ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( e . code == 500 ) : #NEWLINE# #INDENT# ce = InternalServerError ( e ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ce = CouchException ( e ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ce = e #NEWLINE# #UNINDENT# return ce