o 3O@sdZeZgdZGdddeZGdddeZGdddeZGdd d eZGd d d eZ Gd d d eZ Gddde Z Gddde Z Gddde Z Gddde ZGddde ZGddde ZGddde ZGddde ZddZd S)!zlazr.restfulclient errors.) BadRequestConflict ClientErrorCredentialsErrorCredentialsFileError HTTPErrorMethodNotAllowedNotFoundPreconditionFailed RestfulError ResponseError ServerError UnauthorizedUnexpectedResponseErrorc@eZdZdZdS)r z2Base error for the lazr.restfulclient API library.N__name__ __module__ __qualname____doc__rr;/usr/lib/python3/dist-packages/lazr/restfulclient/errors.pyr (r c@r)rz&Base credentials/authentication error.Nrrrrrr,rrc@r)rzError in credentials file.Nrrrrrr0rrc@eZdZdZddZdS)r zError in response.cCst|||_||_dS)N)r __init__responsecontent)selfrrrrrr7s  zResponseError.__init__N)rrrrrrrrrr 4 r c@r)rz$An unexpected response was received.cCsd|jj|jjfS)N%s: %s)rstatusreason)rrrr__str__@szUnexpectedResponseError.__str__Nrrrrr!rrrrr=rrc@r)rz+An HTTP non-2xx response code was received.cCs8dddt|jD}d|jj|jj||jfS)z9Show the error code, response headers, and response body. cSsg|]}d|qS)rr).0pairrrr Is z%HTTPError.__str__..zIHTTP Error %s: %s Response headers: --- %s --- Response body: --- %s --- )joinsortedritemsrr r)rheadersrrrr!Gs  zHTTPError.__str__Nr"rrrrrDrrc@r)rz.An exception representing a client-side error.NrrrrrrQrrc@r)r z4An exception representing an authentication failure.Nrrrrrr Urr c@r)rz1An exception representing a nonexistent resource.NrrrrrrYrrc@r)rzAn exception raised when you use an unsupported HTTP method. This is most likely because you tried to delete a resource that can't be deleted. Nrrrrrr]rrc@r)rz:An exception representing a problem with a client request.Nrrrrrrerrc@r)rz9An exception representing a conflict with another client.Nrrrrrrirrc@r)r zAn exception representing the failure of a conditional PUT/PATCH. The most likely explanation is that another client changed this object while you were working on it, and your version of the object is now out of date. Nrrrrrr mrr c@r)r z.An exception representing a server-side error.Nrrrrrr urr cCsjttttttd}|jddkrdS||jt}|tur0|jddkr't }n |jddkr0t }|||S)zTurn an HTTP response into an HTTPError subclass. :return: None if the response code is 1xx, 2xx or 3xx. Otherwise, an instance of an appropriate HTTPError subclass (or HTTPError if nothing else is appropriate. )iiiiiidN) rr rrrr rgetrr r)rrhttp_errors_by_status_codeclsrrr error_forys   r2N)rtype __metaclass____all__ Exceptionr rrr rrrr rrrrr r r2rrrrs$