| 1 | package Valiant::NestedError; | ||
| 2 | |||
| 3 | 40 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 40 | extends 'Valiant::Error'; | |
| 6 | |||
| 7 | 40 | has 'inner_error' => ( | |
| 8 | is => 'ro', | ||
| 9 | required => 1, | ||
| 10 | handles => { message => 'message' } | ||
| 11 | ); | ||
| 12 | |||
| 13 | 5 | ▶ | around BUILDARGS => sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 14 | 5 | my ($orig, $class, @args) = @_; | |
| 15 | 5 | my $options = $class->$orig(@args); | |
| 16 | |||
| 17 | 5 | return +{ %$options, inner_error=>$options->{options}{inner_error} }; | |
| 18 | 40 | }; | |
| 19 | |||
| 20 | 40 | 1; | |
| 21 | |||
| 22 | =head1 NAME | ||
| 23 | |||
| 24 | Valiant::NestedError - An error imported from another object's errors collection | ||
| 25 | |||
| 26 | =head1 DESCRIPTION | ||
| 27 | |||
| 28 | A subclass of L<Valiant::Error> used by L<Valiant::Errors/import_error> and | ||
| 29 | L<Valiant::Errors/merge> to wrap errors that originated on another object (for | ||
| 30 | example when validations on a nested object add errors that need to appear on | ||
| 31 | the parent). Its message delegates to the original error so translation happens | ||
| 32 | against the object the error was created on. | ||
| 33 | |||
| 34 | You won't usually create one of these yourself. | ||
| 35 | |||
| 36 | =head1 ATTRIBUTES | ||
| 37 | |||
| 38 | =head2 inner_error | ||
| 39 | |||
| 40 | The original L<Valiant::Error> object this error wraps. | ||
| 41 | |||
| 42 | =head1 SEE ALSO | ||
| 43 | |||
| 44 | L<Valiant>, L<Valiant::Error>, L<Valiant::Errors>. | ||
| 45 | |||
| 46 | =head1 AUTHOR | ||
| 47 | |||
| 48 | See L<Valiant> | ||
| 49 | |||
| 50 | =head1 COPYRIGHT & LICENSE | ||
| 51 | |||
| 52 | See L<Valiant> | ||
| 53 | |||
| 54 | =cut | ||