| 1 | package GraphQL::Houtou::Error; | ||||||||||
| 2 | |||||||||||
| 3 | 92 | ▶ | use 5.014; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 92 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 92 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 92 | our $VERSION = '0.08'; | |||||||||
| 8 | |||||||||||
| 9 | use overload | ||||||||||
| 10 | 92 | ▶ | '""' => 'to_string', | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 92 | fallback => 1; | |||||||||
| 12 | |||||||||||
| 13 | 43 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 14 | 43 | my ($class, %args) = @_; | |||||||||
| 15 | die "GraphQL::Houtou::Error requires a 'message'\n" | ||||||||||
| 16 | 43 | ▶ | if !defined $args{message}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | 43 | return bless { %args }, $class; | |||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 8 | ▶ | sub message { return $_[0]->{message} } | ||||||||
|
Subroutine
message: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 21 | 2 | ▶ | sub locations { return $_[0]->{locations} } | ||||||||
|
Subroutine
locations: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 22 | 0 | ▶ | sub path { return $_[0]->{path} } | ||||||||
|
Subroutine
path: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 23 | 0 | ▶ | sub nodes { return $_[0]->{nodes} } | ||||||||
|
Subroutine
nodes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 24 | 4 | ▶ | sub extensions { return $_[0]->{extensions} } | ||||||||
|
Subroutine
extensions: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 25 | 0 | ▶ | sub original_error { return $_[0]->{original_error} } | ||||||||
|
Subroutine
original_error: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 26 | |||||||||||
| 27 | 27 | ▶ | sub to_string { | ||||||||
|
Subroutine
to_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 28 | 27 | my ($self) = @_; | |||||||||
| 29 | 27 | return $self->{message}; | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 33 | ▶ | sub to_json { | ||||||||
|
Subroutine
to_json: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 33 | 33 | my ($self) = @_; | |||||||||
| 34 | 33 | my %json; | |||||||||
| 35 | 33 | for my $key (qw(message locations path extensions)) { | |||||||||
| 36 | 132 | ▶ | $json{$key} = $self->{$key} if exists $self->{$key}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | } | ||||||||||
| 38 | 33 | return \%json; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 92 | 1; | |||||||||
| 42 | __END__ | ||||||||||