File Coverage

blib/lib/UAV/Pilot/Exceptions.pm
Criterion Covered Total %
statement 4 6 66.6
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 6 8 75.0


line stmt bran cond sub pod time code
1             package UAV::Pilot::Exception;
2 1     1   2219 use v5.14;
  1         4  
  1         42  
3 1     1   424 use Moose;
  0            
  0            
4             use namespace::autoclean;
5              
6             with 'Throwable';
7              
8             has 'error' => (
9             is => 'rw',
10             isa => 'Str',
11             );
12              
13             sub to_string
14             {
15             my ($self) = @_;
16             return $self->error;
17             }
18              
19             no Moose;
20             __PACKAGE__->meta->make_immutable;
21              
22              
23             package UAV::Pilot::NumberOutOfRangeException;
24             use v5.14;
25             use Moose;
26             use namespace::autoclean;
27             extends 'UAV::Pilot::Exception';
28              
29             no Moose;
30             __PACKAGE__->meta->make_immutable;
31              
32              
33             package UAV::Pilot::IOException;
34             use v5.14;
35             use Moose;
36             use namespace::autoclean;
37             extends 'UAV::Pilot::Exception';
38              
39             no Moose;
40             __PACKAGE__->meta->make_immutable;
41              
42              
43             package UAV::Pilot::FileNotFoundException;
44             use v5.14;
45             use Moose;
46             use namespace::autoclean;
47             extends 'UAV::Pilot::IOException';
48              
49             has 'file' => (
50             is => 'ro',
51             isa => 'Str',
52             );
53              
54             no Moose;
55             __PACKAGE__->meta->make_immutable;
56              
57              
58             package UAV::Pilot::CommandNotFoundException;
59             use v5.14;
60             use Moose;
61             use namespace::autoclean;
62             extends 'UAV::Pilot::IOException';
63              
64             has 'cmd' => (
65             is => 'ro',
66             isa => 'Str',
67             );
68              
69             no Moose;
70             __PACKAGE__->meta->make_immutable;
71              
72              
73             package UAV::Pilot::NavPacketException::BadHeader;
74             use v5.14;
75             use Moose;
76             use namespace::autoclean;
77             extends 'UAV::Pilot::Exception';
78              
79             has 'got_header' => (
80             is => 'ro',
81             isa => 'Int',
82             );
83              
84             no Moose;
85             __PACKAGE__->meta->make_immutable;
86              
87              
88             package UAV::Pilot::VideoException;
89             use v5.14;
90             use Moose;
91             use namespace::autoclean;
92             extends 'UAV::Pilot::Exception';
93              
94             no Moose;
95             __PACKAGE__->meta->make_immutable;
96              
97              
98             package UAV::Pilot::ArdupilotPacketException::BadHeader;
99             use v5.14;
100             use Moose;
101             use namespace::autoclean;
102             extends 'UAV::Pilot::Exception';
103              
104             has 'got_header' => (
105             is => 'ro',
106             isa => 'Int',
107             );
108              
109             no Moose;
110             __PACKAGE__->meta->make_immutable;
111              
112              
113             package UAV::Pilot::ArdupilotPacketException::BadChecksum;
114             use v5.14;
115             use Moose;
116             use namespace::autoclean;
117             extends 'UAV::Pilot::Exception';
118              
119             has 'got_checksum1' => (
120             is => 'ro',
121             isa => 'Int',
122             );
123             has 'got_checksum2' => (
124             is => 'ro',
125             isa => 'Int',
126             );
127             has 'expected_checksum1' => (
128             is => 'ro',
129             isa => 'Int',
130             );
131             has 'expected_checksum2' => (
132             is => 'ro',
133             isa => 'Int',
134             );
135              
136             no Moose;
137             __PACKAGE__->meta->make_immutable;
138              
139              
140             1;
141             __END__
142              
143              
144             =head1 NAME
145              
146             UAV::Pilot::Exceptions
147              
148             =head1 DESCRIPTION
149              
150             Exceptions that could be thrown by C<UAV::Pilot> modules. All inherit from
151             C<UAV::Pilot::Exception>, which does the role C<Throwable>.
152              
153             =head1 EXCEPTIONS
154              
155             =head2 UAV::Pilot::NumberOutOfRangeException
156              
157             =head2 UAV::Pilot::IOException
158              
159             =head2 UAV::Pilot::CommandNotFoundException
160              
161             =head2 UAV::Pilot::NavPacketException::BadHeader
162              
163             =head2 UAV::Pilot::VideoException
164              
165             =head2 UAV::Pilot::ArdupilotPacketException::BadHeader
166              
167             =head2 UAV::Pilot::ArdupilotPacketException::BadChecksum
168              
169             =cut