| 1 | package OIDC::Client::Error::Provider; | ||||||||||||||||||||||||
| 2 | 13 | ▶ | use utf8; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 3 | 13 | ▶ | use Moose; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 4 | 13 | extends 'OIDC::Client::Error'; | |||||||||||||||||||||||
| 5 | 13 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||
| 7 | =encoding utf8 | ||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||
| 9 | =head1 NAME | ||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||
| 11 | OIDC::Client::Error::Provider | ||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||
| 15 | Error class for a problem returned by the provider. | ||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||
| 17 | =cut | ||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||
| 19 | 13 | has '+message' => ( | |||||||||||||||||||||||
| 20 | builder => '_build_message', | ||||||||||||||||||||||||
| 21 | lazy => 1, | ||||||||||||||||||||||||
| 22 | ); | ||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||
| 24 | has 'response_parameters' => ( | ||||||||||||||||||||||||
| 25 | is => 'ro', | ||||||||||||||||||||||||
| 26 | isa => 'HashRef', | ||||||||||||||||||||||||
| 27 | 3 | ▶ | default => sub { {} }, | ||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 28 | 13 | ); | |||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||
| 30 | 13 | has 'alternative_error' => ( | |||||||||||||||||||||||
| 31 | is => 'ro', | ||||||||||||||||||||||||
| 32 | isa => 'Maybe[Str]', | ||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||
| 35 | 11 | ▶ | sub _build_message { | ||||||||||||||||||||||
|
Subroutine
_build_message: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||
| 36 | 11 | my $self = shift; | |||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||
| 38 | 11 | my $params = $self->{response_parameters}; | |||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||
| 40 | my $message = $params->{error} | ||||||||||||||||||||||||
| 41 | 11 | ▶ | || $self->alternative_error | ||||||||||||||||||||||
|
Condition100%5/5
$params->{'error'} || $self->alternative_error || 'OIDC: problem returned by the provider'
$params->{"error"} or $self->alternative_error
MC/DC100%2/2
$params->{'error'} || $self->alternative_error || 'OIDC: problem returned by the provider'
$params->{"error"}
$self->alternative_error
Truth table100%3/3
A or B
A= $params->{"error"}B= $self->alternative_error
| |||||||||||||||||||||||||
| 42 | || 'OIDC: problem returned by the provider'; | ||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||
| 44 | 11 | ▶ | if (my @description_keys = sort grep { $_ ne 'error' } keys %$params) { | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 45 | 5 | $message .= ' (' . join(', ', map { "$_: $params->{$_}" } @description_keys) . ')'; | |||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||
| 48 | 11 | return $message; | |||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||
| 51 | 13 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||
| 53 | 13 | 1; | |||||||||||||||||||||||