Skip to content

Commit

Permalink
[IMP] product_configurator: Do not recreate same exception
Browse files Browse the repository at this point in the history
  • Loading branch information
SirAionTech authored and dreispt committed Feb 2, 2024
1 parent 4228890 commit 314ff1a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion product_configurator/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _check_default_values(self):
value_ids=default_val_ids, product_tmpl_id=self.id, final=False
)
except ValidationError as exc:
raise ValidationError(exc.args[0]) from exc
raise exc
except Exception as exc:
raise ValidationError(
_("Default values provided generate an invalid configuration")
Expand Down
6 changes: 3 additions & 3 deletions product_configurator/models/product_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ def write(self, vals):
try:
self.validate_configuration(final=False)
except ValidationError as exc:
raise ValidationError(_("%s") % exc.name) from exc
raise exc
except Exception as exc:
raise ValidationError(_("Invalid Configuration")) from exc
return res
Expand Down Expand Up @@ -713,7 +713,7 @@ def create(self, vals_list):
# TODO: Remove if cond when PR with
# raise error on github is merged
except ValidationError as exc:
raise ValidationError(_("%s") % exc.name) from exc
raise exc
except Exception as exc:
raise ValidationError(
_(
Expand Down Expand Up @@ -746,7 +746,7 @@ def create_get_variant(self, value_ids=None, custom_vals=None):
try:
self.validate_configuration()
except ValidationError as exc:
raise ValidationError(_("%s") % exc.name) from exc
raise exc
except Exception as exc:
raise ValidationError(_("Invalid Configuration")) from exc

Expand Down

0 comments on commit 314ff1a

Please sign in to comment.