diff --git a/openstack/session.py b/openstack/session.py index 8a5fc6633..5b087fcf3 100644 --- a/openstack/session.py +++ b/openstack/session.py @@ -70,18 +70,8 @@ def map_exceptions(func): url=e.url, method=e.method, http_status=e.http_status, cause=e) else: - message = e.message - details = e.details - - if e.response is not None: - body = e.response.json() - if 'NeutronError' in body: - err_dict = body['NeutronError'] - message = err_dict.get('message') or message - details = err_dict.get('detail') or details - raise exceptions.HttpException( - message=message, details=details, + message=e.message, details=e.details, response=e.response, request_id=e.request_id, url=e.url, method=e.method, http_status=e.http_status, cause=e) diff --git a/openstack/tests/functional/network/v2/test_router.py b/openstack/tests/functional/network/v2/test_router.py index 8e8a64ea0..1102c5da1 100644 --- a/openstack/tests/functional/network/v2/test_router.py +++ b/openstack/tests/functional/network/v2/test_router.py @@ -12,7 +12,6 @@ import uuid -from openstack import exceptions from openstack.network.v2 import router from openstack.tests.functional import base @@ -55,20 +54,3 @@ class TestRouter(base.BaseFunctionalTest): def test_update(self): sot = self.conn.network.update_router(self.ID, name=self.UPDATE_NAME) self.assertEqual(self.UPDATE_NAME, sot.name) - - def test_error(self): - destination = "10.10.10.0/24" - nexthop = "192.168.0.13" - message = "Invalid input for routes. Reason: Invalid data format " \ - "for hostroute: '{u'destination': u'%s', " \ - "u'nexthop': u'%s'}'." % (destination, nexthop) - - with self.assertRaises(exceptions.HttpException) as cm: - routes = { - "destination": destination, - "nexthop": nexthop, - } - - self.conn.network.update_router(self.ID, routes=routes) - - self.assertEqual(message, cm.exception.message) diff --git a/openstack/tests/unit/test_session.py b/openstack/tests/unit/test_session.py index d36194d17..a1f8ebc85 100644 --- a/openstack/tests/unit/test_session.py +++ b/openstack/tests/unit/test_session.py @@ -82,28 +82,6 @@ class TestSession(testtools.TestCase): self.assertEqual(ksa_exc.http_status, os_exc.http_status) self.assertEqual(ksa_exc, os_exc.cause) - def test_map_exceptions_neutron_exception(self): - fake_response = mock.Mock() - message = "neutron error message" - detail = "neutron detailed message" - body = { - "NeutronError": { - "message": message, - "detail": detail, - } - } - - fake_response.json = mock.Mock(return_value=body) - - ksa_exc = _exceptions.HttpError(response=fake_response) - func = mock.Mock(side_effect=ksa_exc) - - os_exc = self.assertRaises( - exceptions.HttpException, session.map_exceptions(func)) - - self.assertEqual(message, os_exc.message) - self.assertEqual(detail, os_exc.details) - def test_map_exceptions_sdk_exception_1(self): ksa_exc = _exceptions.ClientException() func = mock.Mock(side_effect=ksa_exc)