line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# RDF::Trine::Error |
2
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
RDF::Trine::Error - Error classes for RDF::Trine |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 VERSION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
This document describes RDF::Trine::Error version 1.018 |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use RDF::Trine::Error qw(:try); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
RDF::Trine::Error provides a class hierarchy of errors that other RDF::Trine |
19
|
|
|
|
|
|
|
classes may throw using the L<Error|Error> API. See L<Error> for more |
20
|
|
|
|
|
|
|
information. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 REQUIRES |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
L<Error|Error> |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
package RDF::Trine::Error; |
29
|
|
|
|
|
|
|
|
30
|
68
|
|
|
68
|
|
376
|
use strict; |
|
68
|
|
|
|
|
130
|
|
|
68
|
|
|
|
|
1482
|
|
31
|
68
|
|
|
68
|
|
287
|
use warnings; |
|
68
|
|
|
|
|
119
|
|
|
68
|
|
|
|
|
1394
|
|
32
|
68
|
|
|
68
|
|
313
|
no warnings 'redefine'; |
|
68
|
|
|
|
|
142
|
|
|
68
|
|
|
|
|
1791
|
|
33
|
68
|
|
|
68
|
|
322
|
use Carp qw(carp croak confess); |
|
68
|
|
|
|
|
130
|
|
|
68
|
|
|
|
|
3001
|
|
34
|
|
|
|
|
|
|
|
35
|
68
|
|
|
68
|
|
352
|
use base qw(Error); |
|
68
|
|
|
|
|
140
|
|
|
68
|
|
|
|
|
29333
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
###################################################################### |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
our ($VERSION); |
40
|
|
|
|
|
|
|
BEGIN { |
41
|
68
|
|
|
68
|
|
191845
|
$VERSION = '1.018'; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
###################################################################### |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
package RDF::Trine::Error::CompilationError; |
47
|
|
|
|
|
|
|
|
48
|
68
|
|
|
68
|
|
460
|
use base qw(RDF::Trine::Error); |
|
68
|
|
|
|
|
136
|
|
|
68
|
|
|
|
|
4255
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
package RDF::Trine::Error::QuerySyntaxError; |
51
|
|
|
|
|
|
|
|
52
|
68
|
|
|
68
|
|
388
|
use base qw(RDF::Trine::Error); |
|
68
|
|
|
|
|
138
|
|
|
68
|
|
|
|
|
3741
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
package RDF::Trine::Error::MethodInvocationError; |
55
|
|
|
|
|
|
|
|
56
|
68
|
|
|
68
|
|
366
|
use base qw(RDF::Trine::Error); |
|
68
|
|
|
|
|
133
|
|
|
68
|
|
|
|
|
3541
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
package RDF::Trine::Error::SerializationError; |
59
|
|
|
|
|
|
|
|
60
|
68
|
|
|
68
|
|
360
|
use base qw(RDF::Trine::Error); |
|
68
|
|
|
|
|
158
|
|
|
68
|
|
|
|
|
3602
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
package RDF::Trine::Error::DatabaseError; |
63
|
|
|
|
|
|
|
|
64
|
68
|
|
|
68
|
|
670
|
use base qw(RDF::Trine::Error); |
|
68
|
|
|
|
|
130
|
|
|
68
|
|
|
|
|
3868
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
package RDF::Trine::Error::ParserError; |
67
|
|
|
|
|
|
|
|
68
|
68
|
|
|
68
|
|
375
|
use base qw(RDF::Trine::Error); |
|
68
|
|
|
|
|
137
|
|
|
68
|
|
|
|
|
3747
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
package RDF::Trine::Error::ParserError::Explainable; |
71
|
|
|
|
|
|
|
|
72
|
68
|
|
|
68
|
|
361
|
use base qw(RDF::Trine::Error::ParserError); |
|
68
|
|
|
|
|
143
|
|
|
68
|
|
|
|
|
17513
|
|
73
|
68
|
|
|
68
|
|
2419
|
use Module::Load::Conditional qw[can_load]; |
|
68
|
|
|
|
|
85804
|
|
|
68
|
|
|
|
|
4886
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
our $ANSI; |
76
|
|
|
|
|
|
|
BEGIN { |
77
|
68
|
|
|
68
|
|
502
|
$ANSI = can_load( modules => { 'Term::ANSIColor' => undef } ); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub _get_line { |
81
|
0
|
|
|
0
|
|
|
my $self = shift; |
82
|
0
|
|
|
|
|
|
my $fh = shift; |
83
|
0
|
|
|
|
|
|
my $line = shift; |
84
|
0
|
|
|
|
|
|
my $buffer; |
85
|
0
|
|
|
|
|
|
do { |
86
|
0
|
|
|
|
|
|
$buffer = $fh->getline; |
87
|
|
|
|
|
|
|
} while (--$line); |
88
|
0
|
|
|
|
|
|
return $buffer; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
package RDF::Trine::Error::ParserError::Tokenized; |
92
|
|
|
|
|
|
|
|
93
|
68
|
|
|
68
|
|
1367824
|
use base qw(RDF::Trine::Error::ParserError::Explainable); |
|
68
|
|
|
|
|
161
|
|
|
68
|
|
|
|
|
41706
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub explain { |
96
|
0
|
|
|
0
|
|
|
my $self = shift; |
97
|
0
|
|
|
|
|
|
my $fh = shift; |
98
|
0
|
|
|
|
|
|
seek($fh, 0, 0); |
99
|
0
|
|
|
|
|
|
my $text = $self->text; |
100
|
0
|
|
|
|
|
|
my $t = $self->object; |
101
|
0
|
|
|
|
|
|
my $line = $t->start_line; |
102
|
0
|
|
|
|
|
|
my $col = $t->start_column; |
103
|
0
|
|
|
|
|
|
my $buffer = $self->_get_line( $fh, $line ); |
104
|
0
|
|
|
|
|
|
my $maxlen = length($buffer) - $col; |
105
|
0
|
|
|
|
|
|
my $len = 1; |
106
|
0
|
0
|
|
|
|
|
if ($t->line == $t->start_line) { |
107
|
0
|
|
|
|
|
|
$len = ($t->column - $t->start_column); |
108
|
|
|
|
|
|
|
} else { |
109
|
0
|
|
|
|
|
|
$len = $maxlen; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
my $tabs = ($buffer =~ tr/\t//); |
113
|
0
|
|
|
|
|
|
$buffer =~ s/\t/ /g; |
114
|
0
|
|
|
|
|
|
$col += 3 * $tabs; |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
chomp($text); |
117
|
|
|
|
|
|
|
|
118
|
0
|
0
|
|
|
|
|
if ($RDF::Trine::Error::ParserError::Explainable::ANSI) { |
119
|
0
|
|
|
|
|
|
print STDERR Term::ANSIColor::color('red'); |
120
|
0
|
|
|
|
|
|
print STDERR "$text:\n"; |
121
|
0
|
|
|
|
|
|
print STDERR Term::ANSIColor::color('reset'); |
122
|
0
|
|
|
|
|
|
print STDERR substr($buffer, 0, $col-1); |
123
|
0
|
|
|
|
|
|
print STDERR Term::ANSIColor::color('red'); |
124
|
0
|
|
|
|
|
|
print STDERR substr($buffer, $col-1, $len); |
125
|
0
|
|
|
|
|
|
print STDERR Term::ANSIColor::color('reset'); |
126
|
0
|
|
|
|
|
|
print STDERR substr($buffer, $col+$len-1); |
127
|
0
|
|
|
|
|
|
print STDERR " " x ($col-1); |
128
|
0
|
|
|
|
|
|
print STDERR Term::ANSIColor::color('blue'); |
129
|
0
|
|
|
|
|
|
print STDERR "^"; |
130
|
0
|
0
|
|
|
|
|
if ($len > 1) { |
131
|
0
|
|
|
|
|
|
print STDERR ("~" x ($len-1)); |
132
|
|
|
|
|
|
|
} |
133
|
0
|
|
|
|
|
|
print STDERR "\n"; |
134
|
0
|
|
|
|
|
|
print STDERR Term::ANSIColor::color('reset'); |
135
|
|
|
|
|
|
|
} else { |
136
|
0
|
|
|
|
|
|
print STDERR "$text:\n"; |
137
|
0
|
|
|
|
|
|
print STDERR $buffer; |
138
|
0
|
|
|
|
|
|
print STDERR " " x ($col-1); |
139
|
0
|
|
|
|
|
|
print STDERR "^"; |
140
|
0
|
0
|
|
|
|
|
if ($len > 1) { |
141
|
0
|
|
|
|
|
|
print STDERR ("~" x ($len-1)); |
142
|
|
|
|
|
|
|
} |
143
|
0
|
|
|
|
|
|
print STDERR "\n"; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
package RDF::Trine::Error::ParserError::Positioned; |
148
|
|
|
|
|
|
|
|
149
|
68
|
|
|
68
|
|
522
|
use base qw(RDF::Trine::Error::ParserError::Explainable); |
|
68
|
|
|
|
|
145
|
|
|
68
|
|
|
|
|
28124
|
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub explain { |
152
|
0
|
|
|
0
|
|
|
my $self = shift; |
153
|
0
|
|
|
|
|
|
my $fh = shift; |
154
|
0
|
|
|
|
|
|
seek($fh, 0, 0); |
155
|
0
|
|
|
|
|
|
my $text = $self->text; |
156
|
0
|
|
|
|
|
|
my $pos = $self->value; |
157
|
0
|
|
|
|
|
|
my ($line, $col) = @$pos; |
158
|
0
|
|
0
|
|
|
|
my $buffer = $self->_get_line( $fh, $line ) || ''; |
159
|
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
|
my $tabs = ($buffer =~ tr/\t//); |
161
|
0
|
|
|
|
|
|
$buffer =~ s/\t/ /g; |
162
|
0
|
|
|
|
|
|
$col += 3 * $tabs; |
163
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
|
chomp($text); |
165
|
|
|
|
|
|
|
|
166
|
0
|
0
|
|
|
|
|
if ($RDF::Trine::Error::ParserError::Explainable::ANSI) { |
167
|
0
|
|
|
|
|
|
print STDERR Term::ANSIColor::color('red'); |
168
|
0
|
|
|
|
|
|
print STDERR "$text:\n"; |
169
|
0
|
|
|
|
|
|
print STDERR Term::ANSIColor::color('reset'); |
170
|
0
|
|
|
|
|
|
print STDERR $buffer; |
171
|
0
|
|
|
|
|
|
print STDERR Term::ANSIColor::color('red'); |
172
|
0
|
|
|
|
|
|
print STDERR " " x ($col-1); |
173
|
0
|
|
|
|
|
|
print STDERR "^"; |
174
|
0
|
|
|
|
|
|
print STDERR Term::ANSIColor::color('reset'); |
175
|
0
|
|
|
|
|
|
print STDERR "\n"; |
176
|
|
|
|
|
|
|
} else { |
177
|
0
|
|
|
|
|
|
print STDERR "$text:\n"; |
178
|
0
|
|
|
|
|
|
print STDERR $buffer; |
179
|
0
|
|
|
|
|
|
print STDERR " " x ($col-1); |
180
|
0
|
|
|
|
|
|
print STDERR "^"; |
181
|
0
|
|
|
|
|
|
print STDERR "\n"; |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
package RDF::Trine::Error::UnimplementedError; |
186
|
|
|
|
|
|
|
|
187
|
68
|
|
|
68
|
|
594
|
use base qw(RDF::Trine::Error); |
|
68
|
|
|
|
|
148
|
|
|
68
|
|
|
|
|
4095
|
|
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
1; |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
__END__ |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head1 BUGS |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Please report any bugs or feature requests to through the GitHub web interface |
196
|
|
|
|
|
|
|
at L<https://github.com/kasei/perlrdf/issues>. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 AUTHOR |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Gregory Todd Williams C<< <gwilliams@cpan.org> >> |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 COPYRIGHT |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Copyright (c) 2006-2012 Gregory Todd Williams. This |
205
|
|
|
|
|
|
|
program is free software; you can redistribute it and/or modify it under |
206
|
|
|
|
|
|
|
the same terms as Perl itself. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=cut |