| 1 | package Params::ValidationCompiler::Exceptions; | ||
| 2 | |||
| 3 | 17 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 17 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 17 | our $VERSION = '0.30'; | |
| 7 | |||
| 8 | use Exception::Class ( | ||
| 9 | 17 | 'Params::ValidationCompiler::Exception::BadArguments', | |
| 10 | 'Params::ValidationCompiler::Exception::Named::Extra' => { | ||
| 11 | fields => ['parameters'], | ||
| 12 | }, | ||
| 13 | 'Params::ValidationCompiler::Exception::Named::Required' => { | ||
| 14 | fields => ['parameter'], | ||
| 15 | }, | ||
| 16 | 'Params::ValidationCompiler::Exception::Positional::Extra' => { | ||
| 17 | fields => [ 'got', 'maximum' ], | ||
| 18 | }, | ||
| 19 | 'Params::ValidationCompiler::Exception::Positional::Required' => { | ||
| 20 | fields => [ 'got', 'minimum' ], | ||
| 21 | }, | ||
| 22 | 'Params::ValidationCompiler::Exception::ValidationFailedForMooseTypeConstraint' | ||
| 23 | => { | ||
| 24 | fields => [qw( parameter value type )], | ||
| 25 | }, | ||
| 26 | 17 | ▶ | ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 27 | |||
| 28 | 17 | 1; | |
| 29 | |||
| 30 | # ABSTRACT: Defines exceptions thrown by Params::ValidationCompiler | ||
| 31 | |||
| 32 | __END__ | ||
| 33 | |||
| 34 | =pod | ||
| 35 | |||
| 36 | =encoding UTF-8 | ||
| 37 | |||
| 38 | =head1 NAME | ||
| 39 | |||
| 40 | Params::ValidationCompiler::Exceptions - Defines exceptions thrown by Params::ValidationCompiler | ||
| 41 | |||
| 42 | =head1 VERSION | ||
| 43 | |||
| 44 | version 0.30 | ||
| 45 | |||
| 46 | =head1 DESCRIPTION | ||
| 47 | |||
| 48 | This module defines the following exceptions: | ||
| 49 | |||
| 50 | =head2 Params::ValidationCompiler::Exception::BadArguments | ||
| 51 | |||
| 52 | Exception thrown when @_ does not contain a hash or hashref. | ||
| 53 | |||
| 54 | =head2 Params::ValidationCompiler::Exception::Named::Extra | ||
| 55 | |||
| 56 | Exception thrown when @_ contains unexpected extra named arguments. | ||
| 57 | |||
| 58 | =head2 Params::ValidationCompiler::Exception::Named::Required | ||
| 59 | |||
| 60 | Exception thrown when a required named parameter is not passed. | ||
| 61 | |||
| 62 | =head2 Params::ValidationCompiler::Exception::Positional::Extra | ||
| 63 | |||
| 64 | Exception thrown when @_ contains unexpected extra arguments. | ||
| 65 | |||
| 66 | =head2 Params::ValidationCompiler::Exception::Positional::Required | ||
| 67 | |||
| 68 | Exception thrown when a required positional parameter is not passed. | ||
| 69 | |||
| 70 | =head2 Params::ValidationCompiler::Exception::ValidationFailedForMooseTypeConstraint | ||
| 71 | |||
| 72 | Exception thrown when a Moose type constraint check fails. This class provides | ||
| 73 | the following methods: | ||
| 74 | |||
| 75 | =head3 $e->parameter | ||
| 76 | |||
| 77 | This returns a string describing the parameter, something like C<The 'foo' | ||
| 78 | parameter> or C<Parameter #1>. | ||
| 79 | |||
| 80 | =head3 $e->value | ||
| 81 | |||
| 82 | This is the value that failed the type constraint check. | ||
| 83 | |||
| 84 | =head3 $e->type | ||
| 85 | |||
| 86 | This is the type constraint object that did not accept the value. | ||
| 87 | |||
| 88 | =head1 SUPPORT | ||
| 89 | |||
| 90 | Bugs may be submitted at L<https://github.com/houseabsolute/Params-ValidationCompiler/issues>. | ||
| 91 | |||
| 92 | I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. | ||
| 93 | |||
| 94 | =head1 SOURCE | ||
| 95 | |||
| 96 | The source code repository for Params-ValidationCompiler can be found at L<https://github.com/houseabsolute/Params-ValidationCompiler>. | ||
| 97 | |||
| 98 | =head1 AUTHOR | ||
| 99 | |||
| 100 | Dave Rolsky <autarch@urth.org> | ||
| 101 | |||
| 102 | =head1 COPYRIGHT AND LICENSE | ||
| 103 | |||
| 104 | This software is Copyright (c) 2016 - 2018 by Dave Rolsky. | ||
| 105 | |||
| 106 | This is free software, licensed under: | ||
| 107 | |||
| 108 | The Artistic License 2.0 (GPL Compatible) | ||
| 109 | |||
| 110 | The full text of the license can be found in the | ||
| 111 | F<LICENSE> file included with this distribution. | ||
| 112 | |||
| 113 | =cut | ||