| 1 | package Slick::Error; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.036; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | has error => ( | |||||||||||||||||||||||||||
| 9 | is => 'ro', | ||||||||||||||||||||||||||||
| 10 | required => 1 | ||||||||||||||||||||||||||||
| 11 | ); | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1 | has error_type => ( | |||||||||||||||||||||||||||
| 14 | is => 'ro', | ||||||||||||||||||||||||||||
| 15 | required => 1 | ||||||||||||||||||||||||||||
| 16 | ); | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 8 | ▶ | around new => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 19 | 8 | ▶ | return $_[2] | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($_[2]) and builtin::blessed($_[2]) eq "Slick::Error"
MC/DC100%2/2
builtin::blessed($_[2]) and builtin::blessed($_[2]) eq "Slick::Error"
builtin::blessed($_[2])
builtin::blessed($_[2]) eq "Slick::Error"
Truth table100%3/3
A and B
A= builtin::blessed($_[2])B= builtin::blessed($_[2]) eq "Slick::Error"
| |||||||||||||||||||||||||||||
| 20 | if blessed( $_[2] ) && ( blessed( $_[2] ) eq 'Slick::Error' ); | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 3 | ▶ | return bless { | ||||||||||||||||||||||||||
|
Condition100%2/2
builtin::blessed($_[2]) // "SCALAR"
MC/DC100%1/1
builtin::blessed($_[2]) // "SCALAR"
builtin::blessed($_[2])
Truth table100%2/2
A
A= builtin::blessed($_[2])
| |||||||||||||||||||||||||||||
| 23 | error_type => blessed( $_[2] ) // 'SCALAR', | ||||||||||||||||||||||||||||
| 24 | error => $_[2] | ||||||||||||||||||||||||||||
| 25 | }, | ||||||||||||||||||||||||||||
| 26 | $_[1]; | ||||||||||||||||||||||||||||
| 27 | 1 | }; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 1 | ▶ | sub to_hash { | ||||||||||||||||||||||||||
|
Subroutine
to_hash: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 30 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 31 | 1 | return { error => $self->error, error_type => $self->error_type }; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 1 | 1; | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | =encoding utf8 | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =head1 NAME | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | Slick::Error | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | A Moo wrapper for errors in L<Slick>. | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | =head1 API | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | =head2 error | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | Returns the actual error that was used to construct this object. | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | =head2 error_type | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | Returns the type of the error, C<SCALAR>, or a blessed type. | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | =head2 to_hash | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | Converts the error to a hash. | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | =head1 See also | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | =over 2 | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =item * L<Slick::Context> | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | =item * L<Slick::Database> | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | =item * L<Slick::DatabaseExecutor> | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | =item * L<Slick::DatabaseExecutor::MySQL> | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | =item * L<Slick::DatabaseExecutor::Pg> | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | =item * L<Slick::EventHandler> | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =item * L<Slick::Events> | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | =item * L<Slick::Methods> | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | =item * L<Slick::RouteMap> | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | =item * L<Slick::Util> | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | =back | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | =cut | ||||||||||||||||||||||||||||