File Coverage

blib/lib/REST/Neo4p/Exceptions.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 14 100.0


line stmt bran cond sub pod time code
1             #$Id$
2             package REST::Neo4p::Exceptions;
3 37     37   76068 use strict;
  37         94  
  37         1192  
4 37     37   184 use warnings;
  37         117  
  37         1265  
5              
6             BEGIN {
7 37     37   9490 $REST::Neo4p::Exceptions::VERSION = '0.4000';
8             }
9             use Exception::Class (
10 37         1249 'REST::Neo4p::Exception',
11             'REST::Neo4p::LocalException' => {
12             isa => 'REST::Neo4p::Exception',
13             fields => [ 'code' ],
14             description => 'REST::Neo4p code-local error'
15             },
16             'REST::Neo4p::Neo4jException' => {
17             isa => 'REST::Neo4p::Exception',
18             fields => [ 'code', 'neo4j_message',
19             'neo4j_exception', 'neo4j_stacktrace' ],
20             description => 'Neo4j server errors'
21             },
22             'REST::Neo4p::CommException' =>
23             {
24             isa => 'REST::Neo4p::Exception',
25             fields => [ 'code' ],
26             description => 'Network or HTTP errors'
27             },
28             'REST::Neo4p::AuthException' =>
29             {
30             isa => 'REST::Neo4p::Exception',
31             fields => [ 'code', 'message' ],
32             description => 'Authorization error'
33             },
34             'REST::Neo4p::NotFoundException' => {
35             isa => 'REST::Neo4p::Neo4jException',
36             fields => [ 'code', 'neo4j_message',
37             'neo4j_exception', 'neo4j_stacktrace' ],
38             description => 'URL or item not found'
39             },
40             'REST::Neo4p::ConflictException' => {
41             isa => 'REST::Neo4p::Neo4jException',
42             fields => [ 'code', 'neo4j_message',
43             'neo4j_exception', 'neo4j_stacktrace' ],
44             description => 'Conflict (409) thrown when fail is specified for create_unique on indexes'
45             },
46             'REST::Neo4p::TxQueryException' =>
47             {
48             isa => 'REST::Neo4p::Neo4jException',
49             fields => [qw/error_list message code/],
50             description => 'List of errors returned by query executed within a txn'
51             },
52             'REST::Neo4p::QuerySyntaxException' =>
53             {
54             isa => 'REST::Neo4p::Neo4jException',
55             fields => [ 'code', 'neo4j_message',
56             'neo4j_exception', 'neo4j_stacktrace' ],
57             description => 'Cypher query language syntax error'
58             },
59             'REST::Neo4p::SchemaConstraintExistsException' =>
60             {
61             isa => 'REST::Neo4p::Neo4jException',
62             fields => [qw/error_list neo4j_message code/],
63             description => 'Attempt to create a schema constraint that already exists'
64             },
65             'REST::Neo4p::IndexExistsException' =>
66             {
67             isa => 'REST::Neo4p::Neo4jException',
68             fields => [qw/error_list neo4j_message code/],
69             description => 'Attempt to create an index that already exists'
70             },
71             'REST::Neo4p::NotImplException' => {
72             isa => 'REST::Neo4p::LocalException',
73             description => 'Attempt to call a currently unimplemented method'
74             },
75             'REST::Neo4p::NotSuppException' => {
76             isa => 'REST::Neo4p::LocalException',
77             description => 'Attempt to call a non-supported inherited method'
78             },
79             'REST::Neo4p::TxException' => {
80             isa => 'REST::Neo4p::LocalException',
81             description => 'Problem with transaction building or execution'
82             },
83             'REST::Neo4p::AbstractMethodException' => {
84             isa => 'REST::Neo4p::LocalException',
85             description => 'Attempt to call a subclass-only method from a parent class'
86             },
87             'REST::Neo4p::ClassOnlyException' => {
88             isa => 'REST::Neo4p::LocalException',
89             message => 'This is a class method only',
90             description => 'Attempt to call a class method from an instance'
91             },
92             'REST::Neo4p::VersionMismatchException' => {
93             isa => 'REST::Neo4p::LocalException',
94             message => 'This feature is not supported in your neo4j server version',
95             description => 'Use of features only implemented in a more recent neo4j version'
96             },
97             'REST::Neo4p::QueryResponseException' => {
98             isa => 'REST::Neo4p::LocalException',
99             description => 'Problem parsing the response to a cypher query (prob. a bug)'
100             },
101             'REST::Neo4p::EmptyQueryResponseException' => {
102             isa => 'REST::Neo4p::LocalException',
103             description => 'The server response body was empty; connection problem?'
104             },
105             'REST::Neo4p::StreamException' => {
106             isa => 'REST::Neo4p::LocalException',
107             description => 'Neo4j JSON response parsing error',
108             fields => ['message']
109             },
110             'REST::Neo4p::ConstraintException' => {
111             isa => 'REST::Neo4p::LocalException',
112             description => 'Application-level database constraint violated',
113             fields => ['args']
114             },
115             'REST::Neo4p::ConstraintSpecException' => {
116             isa => 'REST::Neo4p::LocalException',
117             description => 'Constraint specification syntax incorrect',
118             },
119             'REST::Neo4p::Neo4jTightwadException' => {
120             isa => 'REST::Neo4p::LocalException',
121             fields => ['code','message'],
122             description => 'This feature only works in enterprise edition'
123             },
124            
125 37     37   19340 );
  37         324238  
126              
127             =head1 NAME
128              
129             REST::Neo4p::Exceptions - Exception::Class objects for REST::Neo4p
130              
131             =head1 SYNOPSIS
132              
133             use REST::Neo4p;
134            
135             my $server = 'http:127.0.0.1:7474';
136             my $RETRIES = 3;
137             my $e;
138             do {
139             eval {
140             REST::Neo4p->connect($server);
141             $RETRIES--;
142             };
143             } while ( $e = Exception::Class->caught('REST::Neo4p::CommException') );
144             (ref $e && $e->can("rethrow")) ? $e->rethrow : die $e if $e;
145              
146             =head1 Classes
147              
148             =over
149              
150             =item * Base Class : REST::Neo4p::Exception
151              
152             =over
153              
154             =item * REST::Neo4p::CommException
155              
156             Network and server communication errors. Method C returns the
157             HTTP status code.
158              
159             =item * REST::Neo4p::LocalException
160              
161             L module-local errors.
162              
163             =over
164              
165             =item * REST::Neo4p::ClassOnlyException
166              
167             Attempt to use a class-only method on a class instance.
168              
169             =item * REST::Neo4p::NotSuppException
170              
171             Attempt to use a base method not supported in the subclass.
172              
173             =item * REST::Neo4p::NotImplException
174              
175             Attempt to use a not yet implemented method.
176              
177             =item * REST::Neo4p::AbstractMethodException
178              
179             Attempt to call a subclass-only method from a parent class.
180              
181             =item * REST::Neo4p::ConstraintException
182              
183             Attempt to perform a database action that violates an application-level
184             constraint (L, L).
185              
186             =item * REST::Neo4p::ConstraintSpecException
187              
188             Attempt to create a new constraint with incorrect constraint syntax
189             (L,L)
190              
191             =back
192              
193             =item * REST::Neo4p::Neo4jException
194              
195             Exceptions and errors generated by the Neo4j server. Methods
196             C, C, C return
197             server-generated info.
198              
199             =over
200              
201             =item * REST::Neo4p::NotFoundException
202              
203             Requested item not found in database.
204              
205             =item * REST::Neo4p::QuerySyntaxException
206              
207             Bad query syntax (see L).
208              
209             =back
210              
211             =back
212              
213             =back
214              
215             =head1 SEE ALSO
216              
217             L, L
218              
219             =head1 AUTHOR
220              
221             Mark A. Jensen
222             CPAN ID: MAJENSEN
223             TCGA DCC
224             mark -dot- jensen -at- nih -dot- gov
225             http://tcga-data.nci.nih.gov
226              
227             =head1 LICENSE
228              
229             Copyright (c) 2012-2020 Mark A. Jensen. This program is free software; you
230             can redistribute it and/or modify it under the same terms as Perl
231             itself.
232              
233             =cut
234              
235             1;