| 1 | package Protocol::Database::PostgreSQL::Error; | ||||||||||||
| 2 | |||||||||||||
| 3 | 5 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 5 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 5 | our $VERSION = '2.000'; # VERSION | |||||||||||
| 7 | |||||||||||||
| 8 | =head1 NAME | ||||||||||||
| 9 | |||||||||||||
| 10 | Protocol::Database::PostgreSQL::Error - represents a PostgreSQL error | ||||||||||||
| 11 | |||||||||||||
| 12 | =head1 DESCRIPTION | ||||||||||||
| 13 | |||||||||||||
| 14 | This inherits from L<Ryu::Exception> to provide a wrapper for exceptions and notices | ||||||||||||
| 15 | raised by the server. | ||||||||||||
| 16 | |||||||||||||
| 17 | =cut | ||||||||||||
| 18 | |||||||||||||
| 19 | 5 | ▶ | use parent qw(Ryu::Exception); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 20 | |||||||||||||
| 21 | =head1 METHODS | ||||||||||||
| 22 | |||||||||||||
| 23 | =head2 code | ||||||||||||
| 24 | |||||||||||||
| 25 | The failing code. | ||||||||||||
| 26 | |||||||||||||
| 27 | =cut | ||||||||||||
| 28 | |||||||||||||
| 29 | 0 | ▶ | sub code { shift->{code} } | ||||||||||
|
Subroutine
code: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 30 | |||||||||||||
| 31 | =head2 file | ||||||||||||
| 32 | |||||||||||||
| 33 | Which PostgreSQL source file the error was raised from. | ||||||||||||
| 34 | |||||||||||||
| 35 | =cut | ||||||||||||
| 36 | |||||||||||||
| 37 | 0 | ▶ | sub file { shift->{file} } | ||||||||||
|
Subroutine
file: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 38 | |||||||||||||
| 39 | =head2 line | ||||||||||||
| 40 | |||||||||||||
| 41 | The line number in the PostgreSQL source file which raised this error. | ||||||||||||
| 42 | |||||||||||||
| 43 | =cut | ||||||||||||
| 44 | |||||||||||||
| 45 | 0 | ▶ | sub line { shift->{line} } | ||||||||||
|
Subroutine
line: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 46 | |||||||||||||
| 47 | =head2 message | ||||||||||||
| 48 | |||||||||||||
| 49 | The error message from the server. | ||||||||||||
| 50 | |||||||||||||
| 51 | =cut | ||||||||||||
| 52 | |||||||||||||
| 53 | 0 | ▶ | sub message { shift->{message} } | ||||||||||
|
Subroutine
message: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 54 | |||||||||||||
| 55 | =head2 position | ||||||||||||
| 56 | |||||||||||||
| 57 | The character offset in the input query. | ||||||||||||
| 58 | |||||||||||||
| 59 | =cut | ||||||||||||
| 60 | |||||||||||||
| 61 | 0 | ▶ | sub position { shift->{position} } | ||||||||||
|
Subroutine
position: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 62 | |||||||||||||
| 63 | =head2 routine | ||||||||||||
| 64 | |||||||||||||
| 65 | Which PostgreSQL processing routine raised this. | ||||||||||||
| 66 | |||||||||||||
| 67 | =cut | ||||||||||||
| 68 | |||||||||||||
| 69 | 0 | ▶ | sub routine { shift->{routine} } | ||||||||||
|
Subroutine
routine: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 70 | |||||||||||||
| 71 | =head2 severity | ||||||||||||
| 72 | |||||||||||||
| 73 | Relative severity of the error, e.g. NOTICE or FATAL. | ||||||||||||
| 74 | |||||||||||||
| 75 | =cut | ||||||||||||
| 76 | |||||||||||||
| 77 | 0 | ▶ | sub severity { shift->{severity} } | ||||||||||
|
Subroutine
severity: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 78 | |||||||||||||
| 79 | =head2 type | ||||||||||||
| 80 | |||||||||||||
| 81 | Look up the error information in tables extracted from PostgreSQL official documentation. | ||||||||||||
| 82 | Returns a string corresponding to the error code, or C<unknown> if it's not in the tables | ||||||||||||
| 83 | (or from a newer version than this module supports, currently 11.2). | ||||||||||||
| 84 | |||||||||||||
| 85 | =cut | ||||||||||||
| 86 | |||||||||||||
| 87 | 0 | ▶ | sub type { $Protocol::Database::PostgreSQL::ERROR_CODE{shift->{code}} // 'unknown' } | ||||||||||
|
Subroutine
type: not called CC=2 SCAR=17.9
Pod
documented
Condition0%0/2
$Protocol::Database::PostgreSQL::ERROR_CODE{+(shift())->{"code"}} // "unknown"
MC/DC0%0/1
$Protocol::Database::PostgreSQL::ERROR_CODE{+(shift())->{"code"}} // "unknown"
$Protocol::Database::PostgreSQL::ERROR_CODE{+(shift())->{"code"}}
Truth table0%0/2
A
A= $Protocol::Database::PostgreSQL::ERROR_CODE{+(shift())->{"code"}}
| |||||||||||||
| 88 | |||||||||||||
| 89 | 5 | 1; | |||||||||||
| 90 | |||||||||||||
| 91 | =head1 AUTHOR | ||||||||||||
| 92 | |||||||||||||
| 93 | Tom Molesworth <TEAM@cpan.org> | ||||||||||||
| 94 | |||||||||||||
| 95 | =head1 LICENSE | ||||||||||||
| 96 | |||||||||||||
| 97 | Copyright Tom Molesworth 2010-2019. Licensed under the same terms as Perl itself. | ||||||||||||
| 98 | |||||||||||||