Skip to content

Commit

Permalink
Merge pull request #15440 from bernt-matthias/name-validation
Browse files Browse the repository at this point in the history
Add parameter name to validation errors
  • Loading branch information
mvdbeek authored Oct 23, 2023
2 parents f9cecae + 98b71a5 commit 223a8aa
Show file tree
Hide file tree
Showing 3 changed files with 389 additions and 370 deletions.
10 changes: 8 additions & 2 deletions lib/galaxy/tools/parameters/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,10 @@ def validate(self, value, trans=None):
if value in ["", None] and self.optional:
return
for validator in self.validators:
validator.validate(value, trans)
try:
validator.validate(value, trans)
except ValueError as e:
raise ValueError(f"Parameter {self.name}: {e}") from None

def to_dict(self, trans, other_values=None):
"""to_dict tool parameter. This can be overridden by subclasses."""
Expand Down Expand Up @@ -1988,7 +1991,10 @@ def do_validate(v):
):
return
else:
validator.validate(v, trans)
try:
validator.validate(v, trans)
except ValueError as e:
raise ValueError(f"Parameter {self.name}: {e}") from None

dataset_count = 0
if value:
Expand Down
Loading

0 comments on commit 223a8aa

Please sign in to comment.