| 1 | package GraphQL::Houtou::Role::Leaf; | ||||||||||
| 2 | |||||||||||
| 3 | 62 | ▶ | use 5.014; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 62 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 62 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 62 | ▶ | use Role::Tiny; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 62 | ▶ | use GraphQL::Houtou::Error (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | # Runtime completion helpers for scalar-like leaf values. | ||||||||||
| 12 | |||||||||||
| 13 | 0 | ▶ | sub _complete_value { | ||||||||
|
Subroutine
_complete_value: not called CC=2 SCAR=17.9
| |||||||||||
| 14 | 0 | my ($self, $context, $nodes, $info, $path, $result) = @_; | |||||||||
| 15 | 0 | my $serialised = eval { $self->perl_to_graphql($result) }; | |||||||||
| 16 | 0 | my $error = $@; | |||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | die GraphQL::Houtou::Error->new( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 0 | message => "Expected a value of type '@{[$self->to_string]}' but received: '$result'.\n$error" | |||||||||
| 20 | ) if $error; | ||||||||||
| 21 | |||||||||||
| 22 | 0 | return +{ data => $serialised }; | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 62 | 1; | |||||||||