Cleanup for Refactor-error-messages

This patch is a clean-up patch for refactor-error-messages bp
which remove the exception message from base message otherwise
the same exception message display twice like
this https://ibb.co/XyFWMdz .

Depends-On: https://review.opendev.org/#/c/708069/
Change-Id: I00f3153dc3c1de65f6fe36fe444dd2d74c9fbd85
This commit is contained in:
manchandavishal 2020-08-28 18:59:55 +00:00
parent 0865bba79f
commit 9936fccf34
12 changed files with 27 additions and 34 deletions

View File

@ -98,8 +98,7 @@ class OnBoardNS(forms.SelfHandlingForm):
_('NS Catalog entry %s has been created.') %
nsd_instance['nsd']['name'])
return toscal
except Exception as e:
msg = _('Unable to create TOSCA. %s')
msg %= e.message.split('Failed validating', 1)[0]
exceptions.handle(request, message=msg)
except Exception:
msg = _('Unable to create TOSCA.')
exceptions.handle(request, msg)
return False

View File

@ -96,9 +96,9 @@ class NSDEventsTab(tabs.TableTab):
event['event_details'])
utils.EventItemList.add_item(evt_obj)
return utils.EventItemList.EVTLIST_P
except Exception as e:
except Exception:
self._has_more = False
error_message = _('Unable to get events %s') % e
error_message = _('Unable to get events.')
exceptions.handle(self.request, error_message)
return []

View File

@ -170,7 +170,6 @@ class DeployNS(forms.SelfHandlingForm):
_('NS %s create operation initiated.') %
ns_name)
return True
except Exception as e:
except Exception:
exceptions.handle(request,
_('Failed to create NS: %s') %
e.message)
_('Failed to create NS.'))

View File

@ -88,9 +88,9 @@ class NSEventsTab(tabs.TableTab):
event['event_details'])
utils.EventItemList.add_item(evt_obj)
return utils.EventItemList.EVTLIST_P
except Exception as e:
except Exception:
self._has_more = False
error_message = _('Unable to get events %s') % e
error_message = _('Unable to get events.')
exceptions.handle(self.request, error_message)
return []

View File

@ -119,7 +119,6 @@ class RegisterVim(forms.SelfHandlingForm):
_('VIM %s create operation initiated.') %
vim_name)
return True
except Exception as e:
except Exception:
exceptions.handle(request,
_('Failed to register VIM: %s') %
e.message)
_('Failed to register VIM.'))

View File

@ -109,9 +109,9 @@ class VIMEventsTab(tabs.TableTab):
event['event_details'])
utils.EventItemList.add_item(evt_obj)
return utils.EventItemList.EVTLIST_P
except Exception as e:
except Exception:
self._has_more = False
error_message = _('Unable to get events %s') % e
error_message = _('Unable to get events.')
exceptions.handle(self.request, error_message)
return []

View File

@ -101,8 +101,7 @@ class OnBoardVNF(forms.SelfHandlingForm):
_('VNF Catalog entry %s has been created.') %
vnfd_instance['vnfd']['name'])
return toscal
except Exception as e:
msg = _('Unable to create TOSCA. %s')
msg %= e.message.split('Failed validating', 1)[0]
exceptions.handle(request, message=msg)
except Exception:
msg = _('Unable to create TOSCA.')
exceptions.handle(request, msg)
return False

View File

@ -106,9 +106,9 @@ class VNFDEventsTab(tabs.TableTab):
event['event_details'])
utils.EventItemList.add_item(evt_obj)
return utils.EventItemList.EVTLIST_P
except Exception as e:
except Exception:
self._has_more = False
error_message = _('Unable to get events %s') % e
error_message = _('Unable to get events.')
exceptions.handle(self.request, error_message)
return []

View File

@ -100,8 +100,7 @@ class OnBoardVNFFG(forms.SelfHandlingForm):
_('VNFFG Catalog entry %s has been created.') %
vnffgd_instance['vnffgd']['name'])
return toscal
except Exception as e:
msg = _('Unable to create TOSCA. %s')
msg %= e.message.split('Failed validating', 1)[0]
exceptions.handle(request, message=msg)
except Exception:
msg = _('Unable to create TOSCA.')
exceptions.handle(request, msg)
return False

View File

@ -86,7 +86,6 @@ class DeployVNFFG(forms.SelfHandlingForm):
_('VNFFG %s create operation initiated.') %
vnffg_name)
return True
except Exception as e:
except Exception:
exceptions.handle(request,
_('Failed to create VNFFG: %s') %
e.message)
_('Failed to create VNFFG.'))

View File

@ -233,7 +233,6 @@ class DeployVNF(forms.SelfHandlingForm):
_('VNF %s create operation initiated.') %
vnf_name)
return True
except Exception as e:
except Exception:
exceptions.handle(request,
_('Failed to create VNF: %s') %
e.message)
_('Failed to create VNF.'))

View File

@ -111,9 +111,9 @@ class VNFEventsTab(tabs.TableTab):
event['event_details'])
utils.EventItemList.add_item(evt_obj)
return utils.EventItemList.EVTLIST_P
except Exception as e:
except Exception:
self._has_more = False
error_message = _('Unable to get events %s') % e
error_message = _('Unable to get events.')
exceptions.handle(self.request, error_message)
return []