| 1 | package Jmespath::VariadicArityException; | ||
| 2 | use Moose; | ||
| 3 | extends 'Jmespath::ArityException'; | ||
| 4 | with 'Throwable'; | ||
| 5 | |||
| 6 | has expected_arity => ( is => 'ro' ); | ||
| 7 | has actual_arity => ( is => 'ro' ); | ||
| 8 | has name => ( is => 'ro' ); | ||
| 9 | |||
| 10 | sub new { | ||
| 11 | my ( $class, $expected, $actual, $name ) = @_; | ||
| 12 | my $self = $class->SUPER::new( $expected, $actual, $name ); | ||
| 13 | return $self; | ||
| 14 | } | ||
| 15 | |||
| 16 | sub to_string { | ||
| 17 | my ( $self ) = @_; | ||
| 18 | |||
| 19 | return 'Expected at least ' | ||
| 20 | . $self->{ expected_arity } . ' ' | ||
| 21 | . $self->pluralize('argument', $self->{expected_arity}) . ' for function ' | ||
| 22 | . $self->{ function_name } . '(), received ' . $self->{ actual_arity }; | ||
| 23 | } | ||
| 24 | |||
| 25 | no Moose; | ||
| 26 | 1; |