summaryrefslogtreecommitdiff
path: root/lib/Data/MultiValued/Exceptions.pm
blob: b86199eafc624bdf7f745246773cbb301fee3b66 (plain)
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
112
package Data::MultiValued::Exceptions; 
{
  $Data::MultiValued::Exceptions::VERSION = '0.0.1_1';
}
{
  $Data::MultiValued::Exceptions::DIST = 'Data-MultiValued';
}
package Data::MultiValued::Exceptions::NotFound; 
{
  $Data::MultiValued::Exceptions::NotFound::VERSION = '0.0.1_1';
}
{
  $Data::MultiValued::Exceptions::NotFound::DIST = 'Data-MultiValued';
}{
use Moose;
extends 'Throwable::Error';
 
has value => (
    is => 'ro',
    required => 1,
);
 
sub as_string {
    my ($self) = @_;
 
    my $str = $self->message . ($self->value // '<undef>');
    $str .= "\n\n" . $self->stack_trace->as_string;
 
    return $str;
}
 
}
package Data::MultiValued::Exceptions::TagNotFound; 
{
  $Data::MultiValued::Exceptions::TagNotFound::VERSION = '0.0.1_1';
}
{
  $Data::MultiValued::Exceptions::TagNotFound::DIST = 'Data-MultiValued';
}{
use Moose;
extends 'Data::MultiValued::Exceptions::NotFound';
 
has '+message' => (
    default => 'tag not found: ',
);
}
package Data::MultiValued::Exceptions::RangeNotFound; 
{
  $Data::MultiValued::Exceptions::RangeNotFound::VERSION = '0.0.1_1';
}
{
  $Data::MultiValued::Exceptions::RangeNotFound::DIST = 'Data-MultiValued';
}{
use Moose;
extends 'Data::MultiValued::Exceptions::NotFound';
 
has '+message' => (
    default => 'no range found for value ',
);
}
package Data::MultiValued::Exceptions::BadRange; 
{
  $Data::MultiValued::Exceptions::BadRange::VERSION = '0.0.1_1';
}
{
  $Data::MultiValued::Exceptions::BadRange::DIST = 'Data-MultiValued';
}{
use Moose;
extends 'Throwable::Error';
 
has ['from','to'] => ( is => 'ro'required => 1 );
has '+message' => (
    default => 'invalid range: ',
);
 
sub as_string {
    my ($self) = @_;
 
    my $str = $self->message . $self->from . '' . $self->to;
    $str .= "\n\n" . $self->stack_trace->as_string;
 
    return $str;
}
 
}
 
1;
 
__END__
=pod
 
=head1 NAME
 
Data::MultiValued::Exceptions
 
=head1 VERSION
 
version 0.0.1_1
 
=head1 AUTHOR
 
Gianni Ceccarelli <dakkar@thenautilus.net>
 
=head1 COPYRIGHT AND LICENSE
 
This software is copyright (c) 2011 by Net-a-porter.com.
 
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
 
=cut