Refactor error messages
This patchrefactoring the error message and shows the detailed error message Change-Id: I67f7e965e1c20927b396e5d6ecd292e4d7d343db
This commit is contained in:
parent
077a250d7e
commit
4bd9e1e927
@ -109,7 +109,7 @@ class DetailView(horizon.tables.MultiTableView):
|
||||
except Exception as exc:
|
||||
LOG.exception(exc)
|
||||
actions = []
|
||||
msg = _('Action list can not be retrieved.')
|
||||
msg = _('Action list can not be retrieved: %s') % str(exc)
|
||||
horizon.exceptions.handle(self.request, msg)
|
||||
return actions
|
||||
|
||||
@ -121,7 +121,7 @@ class DetailView(horizon.tables.MultiTableView):
|
||||
for indicator in action_plan.efficacy_indicators]
|
||||
except Exception as exc:
|
||||
LOG.exception(exc)
|
||||
msg = _('Failed to get the efficacy indicators.')
|
||||
msg = _('Failed to get the efficacy indicators: %s') % str(exc)
|
||||
LOG.info(msg)
|
||||
horizon.messages.warning(self.request, msg)
|
||||
|
||||
|
@ -42,10 +42,10 @@ class IndexView(horizon.tables.DataTableView):
|
||||
search_opts = self.get_filters()
|
||||
try:
|
||||
actions = watcher.Action.list(self.request, **search_opts)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
horizon.exceptions.handle(
|
||||
self.request,
|
||||
_("Unable to retrieve action information."))
|
||||
_("Unable to retrieve action information: %s") % str(e))
|
||||
return actions
|
||||
|
||||
def get_actions_count(self):
|
||||
|
@ -79,7 +79,7 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
try:
|
||||
goals = watcher.Goal.list(self.request)
|
||||
except Exception as exc:
|
||||
msg = _('Failed to get goals list.')
|
||||
msg = _('Failed to get goals list: %s') % str(exc)
|
||||
LOG.info(msg)
|
||||
messages.warning(request, msg)
|
||||
messages.warning(request, exc)
|
||||
@ -131,7 +131,7 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
messages.success(request, message)
|
||||
return audit_tpl
|
||||
except Exception as exc:
|
||||
msg = _('Failed to create audit template.')
|
||||
msg = _('Failed to create audit template: %s') % str(exc)
|
||||
LOG.info(exc)
|
||||
redirect = reverse(self.failure_url)
|
||||
exceptions.handle(request, msg, redirect=redirect)
|
||||
|
@ -52,7 +52,8 @@ class IndexView(horizon.tables.DataTableView):
|
||||
LOG.exception(exc)
|
||||
horizon.exceptions.handle(
|
||||
self.request,
|
||||
_("Unable to retrieve audit template information."))
|
||||
_("Unable to retrieve audit template "
|
||||
"information: %s") % str(exc))
|
||||
return audit_templates
|
||||
|
||||
def get_count(self):
|
||||
@ -117,7 +118,7 @@ class DetailView(horizon.tabs.TabbedTableView):
|
||||
except Exception as exc:
|
||||
LOG.exception(exc)
|
||||
audits = []
|
||||
msg = _('Audits list cannot be retrieved.')
|
||||
msg = _('Audits list cannot be retrieved: %s') % str(exc)
|
||||
horizon.exceptions.handle(self.request, msg)
|
||||
return audits
|
||||
|
||||
|
@ -69,8 +69,8 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
def _get_audit_template_list(self, request):
|
||||
try:
|
||||
audit_templates = watcher.AuditTemplate.list(self.request)
|
||||
except Exception:
|
||||
msg = _('Failed to get audit template list.')
|
||||
except Exception as e:
|
||||
msg = _('Failed to get audit template list: %s') % str(e)
|
||||
LOG.info(msg)
|
||||
messages.warning(request, msg)
|
||||
audit_templates = []
|
||||
|
@ -56,10 +56,10 @@ class IndexView(horizon.tables.DataTableView):
|
||||
search_opts = self.get_filters()
|
||||
try:
|
||||
audits = watcher.Audit.list(self.request, **search_opts)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
horizon.exceptions.handle(
|
||||
self.request,
|
||||
_("Unable to retrieve audit information."))
|
||||
_("Unable to retrieve audit information: %s") % str(e))
|
||||
return audits
|
||||
|
||||
def get_audits_count(self):
|
||||
@ -117,7 +117,7 @@ class DetailView(horizon.tables.MultiTableView):
|
||||
except Exception as exc:
|
||||
LOG.exception(exc)
|
||||
audits = []
|
||||
msg = _('Action plan list cannot be retrieved.')
|
||||
msg = _('Action plan list cannot be retrieved: %s') % str(exc)
|
||||
horizon.exceptions.handle(self.request, msg)
|
||||
return audits
|
||||
|
||||
|
@ -45,10 +45,10 @@ class IndexView(horizon.tables.DataTableView):
|
||||
search_opts = self.get_filters()
|
||||
try:
|
||||
goals = watcher.Goal.list(self.request, **search_opts)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
horizon.exceptions.handle(
|
||||
self.request,
|
||||
_("Unable to retrieve goal information."))
|
||||
_("Unable to retrieve goal information: %s") % str(e))
|
||||
return goals
|
||||
|
||||
def get_goals_count(self):
|
||||
@ -97,7 +97,7 @@ class DetailView(horizon.tables.MultiTableView):
|
||||
except Exception as exc:
|
||||
LOG.exception(exc)
|
||||
strategies = []
|
||||
msg = _('Strategy list cannot be retrieved.')
|
||||
msg = _('Strategy list cannot be retrieved: %s') % str(exc)
|
||||
horizon.exceptions.handle(self.request, msg)
|
||||
|
||||
return strategies
|
||||
@ -110,7 +110,8 @@ class DetailView(horizon.tables.MultiTableView):
|
||||
except Exception as exc:
|
||||
LOG.exception(exc)
|
||||
indicators_spec = []
|
||||
msg = _('Efficacy specification cannot be retrieved.')
|
||||
msg = _('Efficacy specification cannot be '
|
||||
'retrieved: %s') % str(exc)
|
||||
horizon.exceptions.handle(self.request, msg)
|
||||
|
||||
return indicators_spec
|
||||
|
@ -48,7 +48,7 @@ class IndexView(horizon.tables.DataTableView):
|
||||
LOG.exception(exc)
|
||||
horizon.exceptions.handle(
|
||||
self.request,
|
||||
_("Unable to retrieve strategy information."))
|
||||
_("Unable to retrieve strategy information: %s") % str(exc))
|
||||
return strategies
|
||||
|
||||
def get_strategies_count(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user