line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pandoc::Error; |
2
|
11
|
|
|
11
|
|
222
|
use 5.014; |
|
11
|
|
|
|
|
40
|
|
3
|
11
|
|
|
11
|
|
76
|
use warnings; |
|
11
|
|
|
|
|
25
|
|
|
11
|
|
|
|
|
636
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.9.1'; |
6
|
|
|
|
|
|
|
|
7
|
11
|
|
|
11
|
|
69
|
use overload '""' => 'message', fallback => 1; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
65
|
|
8
|
11
|
|
|
11
|
|
975
|
use Carp; |
|
11
|
|
|
|
|
21
|
|
|
11
|
|
|
|
|
2557
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$Carp::CarpInternal{ (__PACKAGE__) }++; # don't include package in stack trace |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
17
|
100
|
|
17
|
0
|
118
|
my ( $class, %fields ) = @_ % 2 ? @_ : ( shift, message => @_ ); |
14
|
17
|
|
33
|
|
|
731
|
$fields{message} = Carp::shortmess( $fields{message} // $class ); |
15
|
17
|
|
|
|
|
6129
|
bless \%fields, $class; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub throw { |
19
|
17
|
50
|
|
17
|
1
|
78
|
die ref $_[0] ? $_[0] : shift->new(@_); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub message { |
23
|
9
|
|
|
9
|
1
|
284
|
$_[0]->{message}; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 NAME |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Pandoc::Error - Pandoc document processing error |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SYNOPSIS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
use Try::Tiny; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
try { |
37
|
|
|
|
|
|
|
... |
38
|
|
|
|
|
|
|
} catch { |
39
|
|
|
|
|
|
|
if ( blessed $_ && $_->isa('Pandoc::Error') ) { |
40
|
|
|
|
|
|
|
... |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 METHODS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 throw( [ %fields ] ) |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Throw an existing error or create and throw a new error. Setting field |
49
|
|
|
|
|
|
|
C is recommended. The message is enriched with error location. A |
50
|
|
|
|
|
|
|
stack trace can be added with L<$Carp::Verbose|Carp/$Carp::Verbose> or |
51
|
|
|
|
|
|
|
L. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 message |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
The error message. Also returned on stringification. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 SEE ALSO |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
This class does not inherit from L, L or |
60
|
|
|
|
|
|
|
L but may do so in a future version. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |