Skip to content

Commit

Permalink
Fix wrong error yielded
Browse files Browse the repository at this point in the history
  • Loading branch information
lord-haffi committed Jan 12, 2024
1 parent 6a2daec commit ed394f0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/pvframework/mapped_validators/path_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def provide(self, data_set: DataSetT) -> Generator[Parameters[DataSetT] | Except
if param_name in self.validator.required_param_names:
query_error = AttributeError(f"{attr_path} not provided")
query_error.__cause__ = error
yield error
yield query_error
skip = True
break
value = self.validator.signature.parameters[param_name].default
Expand Down
2 changes: 1 addition & 1 deletion src/pvframework/mapped_validators/query_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def provide(self, data_set: DataSetT) -> Generator[Parameters[DataSetT] | Except
if isinstance(param_value, Exception):
assert param_name in self.validator.optional_param_names, (
"If the parameter is required but not supplied you should yield an exception "
"in `paran_sets` directly. The dictionary of parameters should only contain exceptions if"
"in `param_sets` directly. The dictionary of parameters should only contain exceptions if"
"they are negligible aka the parameter is optional."
)
parameter_dict[param_name] = Parameter(
Expand Down
2 changes: 1 addition & 1 deletion unittests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ async def test_unprovided_but_required(self):
validation_summary = await validation_manager.validate(dataset_instance)

assert validation_summary.num_errors_total == 1
assert "'z.z' does not exist" in str(validation_summary.all_errors[0])
assert "z.z not provided" in str(validation_summary.all_errors[0])

async def test_multiple_validator_registration(self):
global finishing_order
Expand Down

0 comments on commit ed394f0

Please sign in to comment.