Skip to content

Commit

Permalink
Improve error message when network creation fails
Browse files Browse the repository at this point in the history
Enhanced error messages extracted from grizzly commit 31d55e5

Fixes bug #1152619

Change-Id: I318eddaed3cbd352fe7ed7e47a196f29111f62f8
  • Loading branch information
jpichon committed Mar 8, 2013
1 parent 8ece3c7 commit e4dcfc3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions horizon/dashboards/nova/networks/workflows.py
Expand Up @@ -134,8 +134,9 @@ def handle(self, request, data):
self.context['net_id'] = network.id
msg = _('Network "%s" was successfully created.') % network.name
LOG.debug(msg)
except:
msg = _('Failed to create network "%s".') % data['net_name']
except Exception as e:
msg = (_('Failed to create network "%(network)s": %(reason)s') %
{"network": data['net_name'], "reason": e})
LOG.info(msg)
redirect = reverse('horizon:nova:networks:index')
exceptions.handle(request, msg, redirect=redirect)
Expand All @@ -156,11 +157,13 @@ def handle(self, request, data):
api.quantum.subnet_create(request, **params)
msg = _('Subnet "%s" was successfully created.') % data['cidr']
LOG.debug(msg)
except Exception:
msg = _('Failed to create subnet "%(sub)s" for network "%(net)s".')
except Exception as e:
msg = _('Failed to create subnet "%(sub)s" for network "%(net)s": '
' %(reason)s')
redirect = reverse('horizon:nova:networks:index')
exceptions.handle(request,
msg % {"sub": data['cidr'], "net": network.id},
msg % {"sub": data['cidr'], "net": network.id,
"reason": e},
redirect=redirect)
return False

Expand Down

0 comments on commit e4dcfc3

Please sign in to comment.