File Coverage

blib/lib/Map/Metro/Exceptions.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 15 15 100.0


line stmt bran cond sub pod time code
1 2     2   17 use 5.10.0;
  2         4  
2 2     2   6 use strict;
  2         2  
  2         43  
3 2     2   5 use warnings;
  2         5  
  2         97  
4              
5             package Map::Metro::Exceptions;
6              
7             # ABSTRACT: Exceptions for Map::Metro
8             our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY
9             our $VERSION = '0.2404';
10              
11 2     2   800 use Throwable::SugarFactory;
  2         70869  
  2         10  
12              
13             exception IncompleteParse
14             => ''
15             => has => [desc => (
16             is => 'ro',
17             lazy => 1,
18             default => sub {
19             my $self = shift;
20             sprintf 'Missing either stations, lines or segments. Check the map file [%s] for errors', $self->mapfile;
21             },
22             )],
23             => has => [mapfile => (is => 'ro')];
24              
25              
26             exception LineidContainsIllegalCharacter
27             => ''
28             => has => [desc => (
29             is => 'ro',
30             lazy => 1,
31             default => sub {
32             my $self = shift;
33             sprintf 'Line id [%s] contains illegal character [%s]', $self->line_id, $self->illegal_character;
34             },
35             )],
36             => has => [line_id => (is => 'ro')],
37             => has => [illegal_character => (is => 'ro')];
38              
39              
40             exception LineidDoesNotExistInLineList
41             => ''
42             => has => [desc => (
43             is => 'ro',
44             lazy => 1,
45             default => sub {
46             my $self = shift;
47             sprintf 'Line id [%s] does not exist in line list (maybe check segments?)', $self->line_id;
48             },
49             )],
50             => has => [line_id => (is => 'ro')];
51              
52              
53             exception StationNameDoesNotExistInStationList
54             => ''
55             => has => [desc => (
56             is => 'ro',
57             lazy => 1,
58             default => sub {
59             my $self = shift;
60             sprintf 'Station name [%s] does not exist in station list (check segments or arguments)', $self->station_name;
61             },
62             )],
63             => has => [station_name => (is => 'ro')];
64              
65              
66             exception StationidDoesNotExist
67             => ''
68             => has => [desc => (
69             is => 'ro',
70             lazy => 1,
71             default => sub {
72             my $self = shift;
73             sprintf 'Station id [%s] does not exist (check arguments)', $self->station_id;
74             },
75             )],
76             => has => [station_id => (is => 'ro')];
77              
78              
79             exception NoSuchMap
80             => ''
81             => has => [desc => (
82             is => 'ro',
83             lazy => 1,
84             default => sub {
85             my $self = shift;
86             sprintf 'Could not find map with name [%s] (check if it is installed)', $self->mapname;
87             },
88             )],
89             => has => [mapname => (is => 'ro')];
90              
91              
92             1;
93              
94             __END__
95              
96             =pod
97              
98             =encoding UTF-8
99              
100             =head1 NAME
101              
102             Map::Metro::Exceptions - Exceptions for Map::Metro
103              
104             =head1 VERSION
105              
106             Version 0.2404, released 2016-04-30.
107              
108             =head1 SOURCE
109              
110             L<https://github.com/Csson/p5-Map-Metro>
111              
112             =head1 HOMEPAGE
113              
114             L<https://metacpan.org/release/Map-Metro>
115              
116             =head1 AUTHOR
117              
118             Erik Carlsson <info@code301.com>
119              
120             =head1 COPYRIGHT AND LICENSE
121              
122             This software is copyright (c) 2016 by Erik Carlsson.
123              
124             This is free software; you can redistribute it and/or modify it under
125             the same terms as the Perl 5 programming language system itself.
126              
127             =cut