From fb9ae6e2c21991ec682109d5202b664377ce5c59 Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Tue, 15 Feb 2022 12:35:58 +0100 Subject: [PATCH] Display error details The red error box will now show why a lease failed to be created or updated, for example if not enough resources are available. Also remove "Please try again" which is not a helpful message. Change-Id: Id0b39fd151956ae6b08ab503a7ae0c5dc09af7f6 --- blazar_dashboard/content/hosts/forms.py | 2 +- blazar_dashboard/content/leases/forms.py | 4 ++-- .../notes/display-error-details-cfd47a4e0a03bc5c.yaml | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/display-error-details-cfd47a4e0a03bc5c.yaml diff --git a/blazar_dashboard/content/hosts/forms.py b/blazar_dashboard/content/hosts/forms.py index 7fcff5d..26da458 100644 --- a/blazar_dashboard/content/hosts/forms.py +++ b/blazar_dashboard/content/hosts/forms.py @@ -48,7 +48,7 @@ class UpdateForm(forms.SelfHandlingForm): LOG.error('Error updating host: %s', e) exceptions.handle(request, message="An error occurred while updating this" - " host. Please try again.") + " host: %s." % e) def clean(self): cleaned_data = super(UpdateForm, self).clean() diff --git a/blazar_dashboard/content/leases/forms.py b/blazar_dashboard/content/leases/forms.py index 19686d4..1d00864 100644 --- a/blazar_dashboard/content/leases/forms.py +++ b/blazar_dashboard/content/leases/forms.py @@ -209,7 +209,7 @@ class CreateForm(forms.SelfHandlingForm): LOG.error('Error submitting lease: %s', e) exceptions.handle(request, message='An error occurred while creating this ' - 'lease. Please try again.') + 'lease: %s.' % e) def clean(self): cleaned_data = super(CreateForm, self).clean() @@ -314,7 +314,7 @@ class UpdateForm(forms.SelfHandlingForm): LOG.error('Error updating lease: %s', e) exceptions.handle(request, message="An error occurred while updating this" - " lease. Please try again.") + " lease: %s." % e) def clean(self): cleaned_data = super(UpdateForm, self).clean() diff --git a/releasenotes/notes/display-error-details-cfd47a4e0a03bc5c.yaml b/releasenotes/notes/display-error-details-cfd47a4e0a03bc5c.yaml new file mode 100644 index 0000000..13d4dc2 --- /dev/null +++ b/releasenotes/notes/display-error-details-cfd47a4e0a03bc5c.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Error details are now displayed when failing to create or update leases.