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