Browse Source

Merge "Cleanup for Refactor-error-messages"

tags/13.0.0.0rc1^0
Zuul 1 week ago
committed by Gerrit Code Review
parent
commit
f98cd4b9e7
2 changed files with 9 additions and 10 deletions
  1. +5
    -6
      bgpvpn_dashboard/dashboards/project/bgpvpn/forms.py
  2. +4
    -4
      bgpvpn_dashboard/dashboards/project/bgpvpn/workflows.py

+ 5
- 6
bgpvpn_dashboard/dashboards/project/bgpvpn/forms.py View File

@@ -131,9 +131,9 @@ class CreateNetworkAssociation(forms.SelfHandlingForm):
else:
self.fields['network_resource'].choices = [('',
_("No network"))]
except Exception as e:
except Exception:
exceptions.handle(
request, _("Unable to retrieve networks: %s") % e)
request, _("Unable to retrieve networks."))

def handle(self, request, data):
try:
@@ -141,10 +141,9 @@ class CreateNetworkAssociation(forms.SelfHandlingForm):
bgpvpn_api.network_association_create(
request, data['bgpvpn_id'], **params)
return True
except Exception as e:
exceptions.handle(
request, _("Unable to associate network {} : {}").format(
data["network_resource"], str(e)))
except Exception:
exceptions.handle(request, (_('Unable to associate network "%s".')
% data["network_resource"]))
return False

def _set_params(self, data):


+ 4
- 4
bgpvpn_dashboard/dashboards/project/bgpvpn/workflows.py View File

@@ -132,8 +132,8 @@ class RouterAssociation(workflows.Workflow):
try:
router_association = bgpvpn_api.router_association_create(
request, bgpvpn_id, router_id=router_id)
except Exception as e:
exceptions.handle(request, msg_error + ": %s" % str(e))
except Exception:
exceptions.handle(request, msg_error)
return False
if not context["with_parameters"]:
return True
@@ -143,7 +143,7 @@ class RouterAssociation(workflows.Workflow):
request, bgpvpn_id, asso_id,
advertise_extra_routes=context['advertise_extra_routes'])
return True
except exceptions as e:
except exceptions:
bgpvpn_api.router_association_delete(request, asso_id, bgpvpn_id)
exceptions.handle(request, msg_error + ": %s" % str(e))
exceptions.handle(request, msg_error)
return False

Loading…
Cancel
Save