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 .

Change-Id: Ib56b35b164057b821b5e9755202b87c9e1ea5572
This commit is contained in:
manchandavishal 2020-08-26 12:22:42 +00:00
parent d46e3cf3e4
commit 0af8c03faf
8 changed files with 27 additions and 37 deletions

View File

@ -130,8 +130,8 @@ class CreateForm(forms.SelfHandlingForm):
messages.success(request, msg)
return True
except Exception as e:
msg = _('Failed to create action: %s') % e
except Exception:
msg = _('Failed to create action.')
redirect = reverse('horizon:mistral:actions:index')
exceptions.handle(request, msg, redirect=redirect)
@ -188,7 +188,7 @@ class UpdateForm(forms.SelfHandlingForm):
messages.success(request, msg)
return True
except Exception as e:
msg = _('Failed to update action: %s') % e
except Exception:
msg = _('Failed to update action.')
redirect = reverse('horizon:mistral:actions:index')
exceptions.handle(request, msg, redirect=redirect)

View File

@ -97,10 +97,10 @@ class IndexView(tables.DataTableView):
reverse=False
)
except Exception as e:
except Exception:
self._prev = False
self._more = False
msg = _('Unable to retrieve actions list: %s') % str(e)
msg = _('Unable to retrieve actions list.')
exceptions.handle(self.request, msg)
return actions

View File

@ -39,7 +39,7 @@ class UpdateDescriptionForm(forms.SelfHandlingForm):
return True
except Exception as e:
msg = _('Failed to update execution description: %s') % e
except Exception:
msg = _('Failed to update execution description.')
redirect = reverse('horizon:mistral:executions:index')
exceptions.handle(request, msg, redirect=redirect)

View File

@ -145,12 +145,9 @@ class UpdateRow(tables.Row):
def get_data(self, request, id):
try:
instance = api.execution_get(request, id)
except Exception as e:
msg = _("Unable to get execution by ID %(id)s: %(e)s.") % {
'id': id, 'e': str(e)
}
except Exception:
msg = _('Unable to get execution by ID "%s".') % id
exceptions.handle(request, msg)
return instance

View File

@ -113,12 +113,11 @@ class IndexView(tables.DataTableView):
reverse=True
)
except Exception as e:
except Exception:
self._prev = False
self._more = False
msg = _('Unable to retrieve executions list: %s') % e
msg = _('Unable to retrieve executions list.')
exceptions.handle(self.request, msg)
return executions
@ -168,15 +167,12 @@ class TasksView(tables.DataTableView):
reverse=True
)
except Exception as e:
except Exception:
self._prev = False
self._more = False
msg = (
_('Unable to retrieve executions list of '
'the requested task: %s') % e
)
msg = _('Unable to retrieve executions list of '
'the requested task.')
exceptions.handle(self.request, msg)
return executions

View File

@ -33,12 +33,9 @@ class UpdateRow(tables.Row):
def get_data(self, request, id):
try:
instance = api.task_get(request, id)
except Exception as e:
msg = _("Unable to get task by ID %(id)s: %(e)s.") % {
'id': id, 'e': str(e)
}
except Exception:
msg = _('Unable to get task by ID "%s".') % id
exceptions.handle(request, msg)
return instance

View File

@ -106,8 +106,8 @@ class CreateForm(forms.SelfHandlingForm):
messages.success(request, msg)
return True
except Exception as e:
msg = _('Failed to create workbook: %s') % e
except Exception:
msg = _('Failed to create workbook.')
redirect = reverse('horizon:mistral:workbooks:index')
exceptions.handle(request, msg, redirect=redirect)
@ -121,7 +121,7 @@ class UpdateForm(CreateForm):
messages.success(request, msg)
return True
except Exception as e:
msg = _('Failed to update workbook: %s') % e
except Exception:
msg = _('Failed to update workbook.')
redirect = reverse('horizon:mistral:workbooks:index')
exceptions.handle(request, msg, redirect=redirect)

View File

@ -69,8 +69,8 @@ class ExecuteForm(forms.SelfHandlingForm):
messages.success(request, msg)
return True
except Exception as e:
msg = _('Failed to execute workflow "%s".') % e
except Exception:
msg = _('Failed to execute workflow.')
redirect = reverse('horizon:mistral:workflows:index')
exceptions.handle(request, msg, redirect=redirect)
@ -159,8 +159,8 @@ class CreateForm(forms.SelfHandlingForm):
messages.success(request, msg)
return True
except Exception as e:
msg = _('Failed to create workflow: %s') % e
except Exception:
msg = _('Failed to create workflow.')
redirect = reverse('horizon:mistral:workflows:index')
exceptions.handle(request, msg, redirect=redirect)
@ -174,7 +174,7 @@ class UpdateForm(CreateForm):
messages.success(request, msg)
return True
except Exception as e:
msg = _('Failed to update workflow: %s') % e
except Exception:
msg = _('Failed to update workflow.')
redirect = reverse('horizon:mistral:workflows:index')
exceptions.handle(request, msg, redirect=redirect)