DrHyde / perl-modules-Params-Validate-Dependencies

extends Params::Validate to support checking for complex dependencies between parameters

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error reporting sucks

DrHyde opened this issue · comments

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.

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.

Partially addressed in @jjatria's PR #10.