New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error reporting of failed validations [PRC] #10

Merged
merged 1 commit into from Jul 11, 2018

Conversation

Projects
None yet
3 participants
@jjatria
Contributor

jjatria commented Jun 21, 2018

This is an attempt at improving the error reporting when calls to validation fail, to address #7.

This maintains most of the existing error message, but extends it by appending the result of calling document on the failed coderef.

The result is something like this:

$ perl -Ilib -E '
    use Params::Validate::Dependencies qw( :all ); 
    my @args = ( foo => 1 ); 
    validate( 
        @args, 
        { 
            foo => 0, 
            bar => 0,
        }, 
        one_of( all_of("foo"), all_of("bar") )
    );
'
code-ref checking failed: arguments were not one of (all of ('foo') or all of ('bar'))

Keeping the existing part of the error message meant that the tests did not need to be changed. 馃帀

@coveralls

This comment has been minimized.

coveralls commented Jun 21, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling c89f80a on jjatria:sucky-docs into b212057 on DrHyde:master.

@DrHyde DrHyde merged commit 808cec6 into DrHyde:master Jul 11, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 100.0%
Details
@DrHyde

This comment has been minimized.

Owner

DrHyde commented Jul 11, 2018

Thanks, merged

@DrHyde DrHyde referenced this pull request Jul 11, 2018

Open

Error reporting sucks #7

@DrHyde

This comment has been minimized.

Owner

DrHyde commented Jul 11, 2018

I'll push a release to the CPAN with this and your other PRs tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment