Refactor error messages
This patch refactors error messages and shows the detailed error message Change-Id: I4d7fc03c9368bf20cd374097ff210e1ecb952d23
This commit is contained in:
parent
eba4d3acec
commit
809416b7b5
@ -130,8 +130,8 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
messages.success(request, msg)
|
||||
|
||||
return True
|
||||
except Exception:
|
||||
msg = _('Failed to create action.')
|
||||
except Exception as e:
|
||||
msg = _('Failed to create action: %s') % e
|
||||
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:
|
||||
msg = _('Failed to update action.')
|
||||
except Exception as e:
|
||||
msg = _('Failed to update action: %s') % e
|
||||
redirect = reverse('horizon:mistral:actions:index')
|
||||
exceptions.handle(request, msg, redirect=redirect)
|
||||
|
@ -39,7 +39,7 @@ class UpdateDescriptionForm(forms.SelfHandlingForm):
|
||||
|
||||
return True
|
||||
|
||||
except Exception:
|
||||
msg = _('Failed to update execution description.')
|
||||
except Exception as e:
|
||||
msg = _('Failed to update execution description: %s') % e
|
||||
redirect = reverse('horizon:mistral:executions:index')
|
||||
exceptions.handle(request, msg, redirect=redirect)
|
||||
|
@ -113,10 +113,10 @@ class IndexView(tables.DataTableView):
|
||||
reverse=True
|
||||
)
|
||||
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
self._prev = False
|
||||
self._more = False
|
||||
msg = _('Unable to retrieve executions list.')
|
||||
msg = _('Unable to retrieve executions list: %s') % e
|
||||
exceptions.handle(self.request, msg)
|
||||
|
||||
return executions
|
||||
@ -168,11 +168,12 @@ class TasksView(tables.DataTableView):
|
||||
reverse=True
|
||||
)
|
||||
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
self._prev = False
|
||||
self._more = False
|
||||
msg = (
|
||||
_('Unable to retrieve executions list of the requested task.')
|
||||
_('Unable to retrieve executions list of '
|
||||
'the requested task: %s') % e
|
||||
)
|
||||
exceptions.handle(self.request, msg)
|
||||
|
||||
|
@ -108,8 +108,8 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
messages.success(request, msg)
|
||||
|
||||
return True
|
||||
except Exception:
|
||||
msg = _('Failed to create workbook.')
|
||||
except Exception as e:
|
||||
msg = _('Failed to create workbook: %s') % e
|
||||
redirect = reverse('horizon:mistral:workbooks:index')
|
||||
exceptions.handle(request, msg, redirect=redirect)
|
||||
|
||||
@ -123,7 +123,7 @@ class UpdateForm(CreateForm):
|
||||
messages.success(request, msg)
|
||||
|
||||
return True
|
||||
except Exception:
|
||||
msg = _('Failed to update workbook.')
|
||||
except Exception as e:
|
||||
msg = _('Failed to update workbook: %s') % e
|
||||
redirect = reverse('horizon:mistral:workbooks:index')
|
||||
exceptions.handle(request, msg, redirect=redirect)
|
||||
|
@ -161,8 +161,8 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
messages.success(request, msg)
|
||||
|
||||
return True
|
||||
except Exception:
|
||||
msg = _('Failed to create workflow.')
|
||||
except Exception as e:
|
||||
msg = _('Failed to create workflow: %s') % e
|
||||
redirect = reverse('horizon:mistral:workflows:index')
|
||||
exceptions.handle(request, msg, redirect=redirect)
|
||||
|
||||
@ -176,7 +176,7 @@ class UpdateForm(CreateForm):
|
||||
messages.success(request, msg)
|
||||
|
||||
return True
|
||||
except Exception:
|
||||
msg = _('Failed to update workflow.')
|
||||
except Exception as e:
|
||||
msg = _('Failed to update workflow: %s') % e
|
||||
redirect = reverse('horizon:mistral:workflows:index')
|
||||
exceptions.handle(request, msg, redirect=redirect)
|
||||
|
Loading…
x
Reference in New Issue
Block a user