Fix improper error message when reducing partition size

When attempting to reduce partition size from the GUI, a generic
error message is returned. This occurs because providing the complete
error details to the error handler can lead to the generation of
a distinct exception.

Test plan:
  Install Standard. Create partition and
  attempt to reduce size from GUI.
  Verify that error message indicates
  that is not possible to reduce partitions.
  Also verify that right error message is present in
  horizon.log and that any other exception dissapear
  for this action.

Closes-Bug: 2015918

Signed-off-by: fperez <fabrizio.perez@windriver.com>
Change-Id: I9ad7315f9e428d029b30ea230c343a4fe1df8a5f
This commit is contained in:
fperez 2023-04-11 13:33:38 -03:00 committed by Fabrizio Perez
parent ba46600775
commit db9bb2cf03
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2013-2021 Wind River Systems, Inc.
# Copyright (c) 2013-2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -678,7 +678,7 @@ class EditPartition(forms.SelfHandlingForm):
# No redirect, return to previous storage tab view.
# The REST API error message will appear on UI as
# "horizon.exceptions.handle" will invoke "messages.error".
return exceptions.handle(request, message=ce)
return exceptions.handle(request, message=msg)
except Exception as e:
msg = _('Failed to update partition.')
LOG.info(msg)