File Coverage

blib/lib/Map/Tube/Exception.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 22 23 95.6


line stmt bran cond sub pod time code
1             package Map::Tube::Exception;
2             $Map::Tube::Exception::AUTHORITY = 'cpan:MANWAR';
3             $Map::Tube::Exception::VERSION = '3.24';
4             =head1 NAME
5              
6             Map::Tube::Exception - Base exception package as Moo Role for Map::Tube::* family.
7              
8             =head1 VERSION
9              
10             version 3.24
11              
12             =cut
13              
14 2     2   101263 use 5.006;
  2         8  
15 2     2   516 use Data::Dumper;
  2         7553  
  2         156  
16              
17 2     2   406 use Moo::Role;
  2         11794  
  2         15  
18 2     2   1525 use namespace::autoclean;
  2         16092  
  2         13  
19             requires qw(status);
20             with 'Throwable';
21              
22 2     2   3029 use overload q{""} => 'as_string', fallback => 1;
  2         3658  
  2         12  
23              
24             has method => (is => 'ro');
25             has message => (is => 'ro');
26             has filename => (is => 'ro');
27             has line_number => (is => 'ro');
28              
29             sub as_string {
30 21     21 0 5892 my ($self) = @_;
31              
32 21         261 return sprintf("%s(): %s (status: %s) file %s on line %d\n",
33             $self->method, $self->message, $self->status,
34             $self->filename, $self->line_number);
35             }
36              
37             =head1 DESCRIPTION
38              
39             Base exception package as Moo Role for Map::Tube::* family.
40              
41             Extracted out of the distribution L v3.0,so that it can be shared with
42             Map::Tube and it's Map::Tube::* family. It has been re-structured in the process.
43              
44             =head1 STATUS CODES
45              
46             +-------------+-------------------------------------------------------------+
47             | Status Code | Description |
48             +-------------+-------------------------------------------------------------+
49             | 100 | Missing station name. |
50             | 101 | Invalid station name. |
51             | 102 | Missing station id. |
52             | 103 | Invalid station id. |
53             | 104 | Missing line name. |
54             | 105 | Invalid line name. |
55             | 106 | Missing node object i.e. Map::Tube::Node. |
56             | 107 | Invalid node object. |
57             | 108 | Missing plugin graph i.e Map::Tube::Plugin::Graph. |
58             | 109 | Duplicate station name. |
59             | 110 | Duplicate station id. |
60             | 111 | Found self linked station. |
61             | 112 | Found multi linked station. |
62             | 113 | Found multi lined station. |
63             | 114 | Found unsupported map. |
64             | 115 | Missing supported map. |
65             | 116 | Found unsupported object. |
66             | 117 | Missing supported object, Map::Tube::Node / Map::Tube::Line |
67             | 118 | Invalid supported object. |
68             | 119 | Invalid line id. |
69             | 120 | Missing line id. |
70             | 121 | Missing plugin fuzzy find i.e. Map::Tube::Plugin::FuzzyFind |
71             | 122 | Missing plugin formatter i.e. Map::Tube::Plugin::Formatter |
72             | 123 | Invalid line color. |
73             | 124 | Missing Map Data. |
74             | 125 | Found unsupported map data format. |
75             | 126 | Malformed Map Data. |
76             | 127 | Invalid color hex code. |
77             | 128 | Invalid line structure. |
78             | 129 | Invalid station structure. |
79             | 130 | Invalid background color. |
80             | 131 | Invalid color name. |
81             | 132 | Invalid station line id. |
82             | 133 | Route not found. |
83             +-------------+-------------------------------------------------------------+
84              
85             =head1 AUTHOR
86              
87             Mohammad Sajid Anwar, C<< >>
88              
89             =head1 REPOSITORY
90              
91             L
92              
93             =head1 BUGS
94              
95             Please report any bugs or feature requests through the web interface at L.
96             I will be notified, and then you'll automatically be notified of progress on your
97             bug as I make changes.
98              
99             =head1 SUPPORT
100              
101             You can find documentation for this module with the perldoc command.
102              
103             perldoc Map::Tube::Exception
104              
105             You can also look for information at:
106              
107             =over 4
108              
109             =item * BUG Report
110              
111             L
112              
113             =item * CPAN Ratings
114              
115             L
116              
117             =item * Search MetaCPAN
118              
119             L
120              
121             =back
122              
123             =head1 LICENSE AND COPYRIGHT
124              
125             Copyright (C) 2015 - 2024 Mohammad Sajid Anwar.
126              
127             This program is free software; you can redistribute it and/or modify it under
128             the terms of the the Artistic License (2.0). You may obtain a copy of the full
129             license at:
130              
131             L
132              
133             Any use, modification, and distribution of the Standard or Modified Versions is
134             governed by this Artistic License.By using, modifying or distributing the Package,
135             you accept this license. Do not use, modify, or distribute the Package, if you do
136             not accept this license.
137              
138             If your Modified Version has been derived from a Modified Version made by someone
139             other than you,you are nevertheless required to ensure that your Modified Version
140             complies with the requirements of this license.
141              
142             This license does not grant you the right to use any trademark, service mark,
143             tradename, or logo of the Copyright Holder.
144              
145             This license includes the non-exclusive, worldwide, free-of-charge patent license
146             to make, have made, use, offer to sell, sell, import and otherwise transfer the
147             Package with respect to any patent claims licensable by the Copyright Holder that
148             are necessarily infringed by the Package. If you institute patent litigation
149             (including a cross-claim or counterclaim) against any party alleging that the
150             Package constitutes direct or contributory patent infringement,then this Artistic
151             License to you shall terminate on the date that such litigation is filed.
152              
153             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND
154             CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
155             WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
156             NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
157             REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
158             INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
159             OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
160              
161             =cut
162              
163             1; # End of Map::Tube::Exception