Valiant/NestedError.pm

filter: Statementstmt 100% 10 / 10 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 12 / 12 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
__ANON__
1.0
CRAP 1.0
« Valiant/HTML/locale/errors.pl ↑ Summary Valiant/Util/Exception/Strict.pm »
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
« Valiant/HTML/locale/errors.pl ↑ Summary Valiant/Util/Exception/Strict.pm »