Revert "Set default http-based exception as HttpError
"
This reverts commit 4e1ee661083bd672a884fd13fdb1ffaadea5252a. This change is a part of a series that is not backwards compatible, and caused breakage in applications that use the client library. Change-Id: If614826fb0832602110c1ac8be2c0e6324a5a248 Partial-Bug: #1340596
This commit is contained in:
parent
f1db442bec
commit
e14f9741a6
novaclient
@ -139,7 +139,7 @@ class ManagerWithFind(Manager):
|
||||
num_matches = len(matches)
|
||||
if num_matches == 0:
|
||||
msg = "No %s matching %s." % (self.resource_class.__name__, kwargs)
|
||||
raise exceptions.NotFound(msg)
|
||||
raise exceptions.NotFound(404, msg)
|
||||
elif num_matches > 1:
|
||||
raise exceptions.NoUniqueMatch
|
||||
else:
|
||||
|
@ -28,15 +28,6 @@ from novaclient.openstack.common.apiclient.exceptions import * # noqa
|
||||
OverLimit = RequestEntityTooLarge
|
||||
|
||||
|
||||
def _deprecate_code_attribute(slf):
|
||||
import warnings
|
||||
warnings.warn("'code' attribute is deprecated since v.2.17.0. Use "
|
||||
"'http_status' instead of this one.", UserWarning)
|
||||
return slf.http_status
|
||||
|
||||
HttpError.code = property(_deprecate_code_attribute)
|
||||
|
||||
|
||||
class NoTokenLookupException(ClientException):
|
||||
"""This form of authentication does not support looking up
|
||||
endpoints from an existing token.
|
||||
@ -76,7 +67,7 @@ class InvalidUsage(RuntimeError):
|
||||
|
||||
def from_response(response, body, url, method=None):
|
||||
"""
|
||||
Return an instance of an HttpError or subclass
|
||||
Return an instance of an ClientException or subclass
|
||||
based on an requests response.
|
||||
|
||||
Usage::
|
||||
@ -110,6 +101,5 @@ def from_response(response, body, url, method=None):
|
||||
kwargs['message'] = message
|
||||
kwargs['details'] = details
|
||||
|
||||
cls = _code_map.get(response.status_code, HttpError)
|
||||
|
||||
cls = _code_map.get(response.status_code, ClientException)
|
||||
return cls(**kwargs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user