diff --git a/openstack_dashboard/static/app/core/openstack-service-api/network.service.js b/openstack_dashboard/static/app/core/openstack-service-api/network.service.js index c84dff1f60..e5b8e78dc5 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/network.service.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/network.service.js @@ -59,8 +59,9 @@ */ function getFloatingIps() { return apiService.get('/api/network/floatingips/') - .catch(function onError() { + .catch(function onError(response) { toastService.add('error', gettext('Unable to retrieve floating IPs.')); + throw response; }); } @@ -74,8 +75,9 @@ */ function getFloatingIpPools() { return apiService.get('/api/network/floatingippools/') - .catch(function onError() { + .catch(function onError(response) { toastService.add('error', gettext('Unable to retrieve floating IP pools.')); + throw response; }); } @@ -91,8 +93,9 @@ */ function allocateFloatingIp(poolId) { return apiService.post('/api/network/floatingip/', { pool_id: poolId }) - .catch(function onError() { + .catch(function onError(response) { toastService.add('error', gettext('Unable to allocate new floating IP address.')); + throw response; }); } @@ -111,8 +114,9 @@ function associateFloatingIp(addressId, portId) { var params = { address_id: addressId, port_id: portId }; return apiService.patch('/api/network/floatingip/', params) - .catch(function onError() { + .catch(function onError(response) { toastService.add('error', gettext('Unable to associate floating IP address.')); + throw response; }); } @@ -127,8 +131,9 @@ */ function disassociateFloatingIp(addressId) { return apiService.patch('/api/network/floatingip/', { address_id: addressId }) - .catch(function onError() { + .catch(function onError(response) { toastService.add('error', gettext('Unable to disassociate floating IP address.')); + throw response; }); } diff --git a/openstack_dashboard/static/app/core/openstack-service-api/network.service.spec.js b/openstack_dashboard/static/app/core/openstack-service-api/network.service.spec.js index 913795121a..e16a577d4b 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/network.service.spec.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/network.service.spec.js @@ -42,13 +42,15 @@ func: 'getFloatingIps', method: 'get', path: '/api/network/floatingips/', - error: 'Unable to retrieve floating IPs.' + error: 'Unable to retrieve floating IPs.', + throws: true }, { func: 'getFloatingIpPools', method: 'get', path: '/api/network/floatingippools/', - error: 'Unable to retrieve floating IP pools.' + error: 'Unable to retrieve floating IP pools.', + throws: true }, { func: 'allocateFloatingIp', @@ -56,7 +58,8 @@ path: '/api/network/floatingip/', data: { pool_id: 'pool' }, error: 'Unable to allocate new floating IP address.', - testInput: [ 'pool' ] + testInput: [ 'pool' ], + throws: true }, { func: 'associateFloatingIp', @@ -64,7 +67,8 @@ path: '/api/network/floatingip/', data: { address_id: 'address', port_id: 'port' }, error: 'Unable to associate floating IP address.', - testInput: [ 'address', 'port' ] + testInput: [ 'address', 'port' ], + throws: true }, { func: 'disassociateFloatingIp', @@ -72,7 +76,8 @@ path: '/api/network/floatingip/', data: { address_id: 'address' }, error: 'Unable to disassociate floating IP address.', - testInput: [ 'address' ] + testInput: [ 'address' ], + throws: true } ];