Merge "Cleanup for Refactor-error-messages"
This commit is contained in:
2 changed files with 9 additions and 10 deletions
@@ -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):
@@ -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
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.