DrHyde / perl-modules-Params-Validate-Dependencies

extends Params::Validate to support checking for complex dependencies between parameters
7 stars 3 forks source link

Error reporting sucks #7

Open DrHyde opened 7 years ago

DrHyde commented 7 years ago

The trouble is that it's OK for some checks to fail. Consider this:

one_of( all_of(qw(alpha beta gamma)), all_of(qw(ant bat cat)) )

which will say "everything's OK" you supply either parameters alpha, beta, and gamma, or parameters ant, bat, and cat. You can potentially only know whether you pass or fail after you've evaluated all the options, and I don't think it makes much sense to tell the user "you failed, and these are all the sub-clauses that failed" because it's OK for some of them to fail.

Basically unless anyone has a Brilliant Idea the best I can do, I think, is to improve the error message by having it spit out the documentation for your check function and the data you supplied.

skington commented 7 years ago

Spitting out the documentation and the data supplied would be a good start. What would also be good would be for all_of to tell you if e.g. you'd supplied alpha and gamma, but not beta.

DrHyde commented 6 years ago

Partially addressed in @jjatria's PR #10.