File: Exceptions.pm

package info (click to toggle)
libparams-validationcompiler-perl 0.31-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 468 kB
  • sloc: perl: 1,608; sh: 23; makefile: 2
file content (111 lines) | stat: -rw-r--r-- 2,811 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package Params::ValidationCompiler::Exceptions;

use strict;
use warnings;

our $VERSION = '0.31';

use Exception::Class (
    'Params::ValidationCompiler::Exception::BadArguments',
    'Params::ValidationCompiler::Exception::Named::Extra' => {
        fields => ['parameters'],
    },
    'Params::ValidationCompiler::Exception::Named::Required' => {
        fields => ['parameter'],
    },
    'Params::ValidationCompiler::Exception::Positional::Extra' => {
        fields => [ 'got', 'maximum' ],
    },
    'Params::ValidationCompiler::Exception::Positional::Required' => {
        fields => [ 'got', 'minimum' ],
    },
    'Params::ValidationCompiler::Exception::ValidationFailedForMooseTypeConstraint'
        => {
        fields => [qw( parameter value type )],
        },
);

1;

# ABSTRACT: Defines exceptions thrown by Params::ValidationCompiler

__END__

=pod

=encoding UTF-8

=head1 NAME

Params::ValidationCompiler::Exceptions - Defines exceptions thrown by Params::ValidationCompiler

=head1 VERSION

version 0.31

=head1 DESCRIPTION

This module defines the following exceptions:

=head2 Params::ValidationCompiler::Exception::BadArguments

Exception thrown when @_ does not contain a hash or hashref.

=head2 Params::ValidationCompiler::Exception::Named::Extra

Exception thrown when @_ contains unexpected extra named arguments.

=head2 Params::ValidationCompiler::Exception::Named::Required

Exception thrown when a required named parameter is not passed.

=head2 Params::ValidationCompiler::Exception::Positional::Extra

Exception thrown when @_ contains unexpected extra arguments.

=head2 Params::ValidationCompiler::Exception::Positional::Required

Exception thrown when a required positional parameter is not passed.

=head2 Params::ValidationCompiler::Exception::ValidationFailedForMooseTypeConstraint

Exception thrown when a Moose type constraint check fails. This class provides
the following methods:

=head3 $e->parameter

This returns a string describing the parameter, something like C<The 'foo'
parameter> or C<Parameter #1>.

=head3 $e->value

This is the value that failed the type constraint check.

=head3 $e->type

This is the type constraint object that did not accept the value.

=head1 SUPPORT

Bugs may be submitted at L<https://github.com/houseabsolute/Params-ValidationCompiler/issues>.

=head1 SOURCE

The source code repository for Params-ValidationCompiler can be found at L<https://github.com/houseabsolute/Params-ValidationCompiler>.

=head1 AUTHOR

Dave Rolsky <autarch@urth.org>

=head1 COPYRIGHT AND LICENSE

This software is Copyright (c) 2016 - 2023 by Dave Rolsky.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)

The full text of the license can be found in the
F<LICENSE> file included with this distribution.

=cut