| 1 | # Copyright 2022 Google LLC and contributors | ||||||||||||
| 2 | # | ||||||||||||
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||
| 4 | # you may not use this file except in compliance with the License. | ||||||||||||
| 5 | # You may obtain a copy of the License at | ||||||||||||
| 6 | # | ||||||||||||
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||
| 8 | # | ||||||||||||
| 9 | # Unless required by applicable law or agreed to in writing, software | ||||||||||||
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||
| 12 | # See the License for the specific language governing permissions and | ||||||||||||
| 13 | # limitations under the License. | ||||||||||||
| 14 | |||||||||||||
| 15 | package Google::Auth::Exceptions; | ||||||||||||
| 16 | |||||||||||||
| 17 | 16 | ▶ | use 5.006; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 18 | 16 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 19 | 16 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 20 | |||||||||||||
| 21 | =head1 NAME | ||||||||||||
| 22 | |||||||||||||
| 23 | Google::Auth::Exceptions - Exceptions used in the Google::Auth package | ||||||||||||
| 24 | |||||||||||||
| 25 | =head1 VERSION | ||||||||||||
| 26 | |||||||||||||
| 27 | Version 0.09 | ||||||||||||
| 28 | |||||||||||||
| 29 | =cut | ||||||||||||
| 30 | |||||||||||||
| 31 | # Base class for all google.auth errors | ||||||||||||
| 32 | |||||||||||||
| 33 | package Google::Auth::Error; | ||||||||||||
| 34 | 16 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 35 | 16 | ▶ | use overload '""' => \&to_string, fallback => 1; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 36 | |||||||||||||
| 37 | 16 | has message => (is => 'ro', required => 1); | |||||||||||
| 38 | |||||||||||||
| 39 | 61 | ▶ | sub to_string { | ||||||||||
|
Subroutine
to_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 40 | 61 | my ($self) = @_; | |||||||||||
| 41 | 61 | return $self->message; | |||||||||||
| 42 | } | ||||||||||||
| 43 | |||||||||||||
| 44 | 33 | ▶ | sub throw { | ||||||||||
|
Subroutine
throw: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||
| 45 | 33 | my ($class, $message) = @_; | |||||||||||
| 46 | 33 | ▶ | if (ref $class) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 47 | 0 | die $class; | |||||||||||
| 48 | } | ||||||||||||
| 49 | 33 | ▶ | my $self = $class->new({message => $message || 'Unknown error'}); | ||||||||||
|
Condition50%1/2
$message || 'Unknown error'
MC/DC0%0/1
$message || 'Unknown error'
$message
Truth table50%1/2
A
A= $message
| |||||||||||||
| 50 | 33 | die $self; | |||||||||||
| 51 | } | ||||||||||||
| 52 | |||||||||||||
| 53 | # Used to indicate an error occurred during an HTTP request | ||||||||||||
| 54 | #[%- Perl::Critic::Policy::Modules::ProhibitMultiplePackages %] | ||||||||||||
| 55 | package Google::Auth::TransportError; | ||||||||||||
| 56 | 16 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 57 | 16 | extends 'Google::Auth::Error'; | |||||||||||
| 58 | |||||||||||||
| 59 | # Used to indicate failure to refresh the credentials' access token | ||||||||||||
| 60 | #[%- Perl::Critic::Policy::Modules::ProhibitMultiplePackages %] | ||||||||||||
| 61 | package Google::Auth::RefreshError; | ||||||||||||
| 62 | 16 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 63 | 16 | extends 'Google::Auth::Error'; | |||||||||||
| 64 | |||||||||||||
| 65 | # Used to indicate failure to acquire default credentials | ||||||||||||
| 66 | #[%- Perl::Critic::Policy::Modules::ProhibitMultiplePackages %] | ||||||||||||
| 67 | package Google::Auth::DefaultCredentialsError; | ||||||||||||
| 68 | 16 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 69 | 16 | extends 'Google::Auth::Error'; | |||||||||||
| 70 | |||||||||||||
| 71 | =head1 AUTHOR | ||||||||||||
| 72 | |||||||||||||
| 73 | C.J. Collier, C<< <cjac at google.com> >> | ||||||||||||
| 74 | |||||||||||||
| 75 | =head1 BUGS AND SUPPORT | ||||||||||||
| 76 | |||||||||||||
| 77 | Please report any bugs or feature requests to the GitHub issue tracker at | ||||||||||||
| 78 | L<https://github.com/GoogleCloudPlatform/google-auth-library-perl/issues> or via RT at | ||||||||||||
| 79 | L<https://rt.cpan.org/Dist/Display.html?Name=Google-Auth>. | ||||||||||||
| 80 | |||||||||||||
| 81 | You can also look for information at: | ||||||||||||
| 82 | |||||||||||||
| 83 | =over 4 | ||||||||||||
| 84 | |||||||||||||
| 85 | =item * GitHub Issue Tracker | ||||||||||||
| 86 | |||||||||||||
| 87 | L<https://github.com/GoogleCloudPlatform/google-auth-library-perl/issues> | ||||||||||||
| 88 | |||||||||||||
| 89 | =item * RT: CPAN's Request Tracker | ||||||||||||
| 90 | |||||||||||||
| 91 | L<https://rt.cpan.org/Dist/Display.html?Name=Google-Auth> | ||||||||||||
| 92 | |||||||||||||
| 93 | =item * MetaCPAN | ||||||||||||
| 94 | |||||||||||||
| 95 | L<https://metacpan.org/release/Google-Auth> | ||||||||||||
| 96 | |||||||||||||
| 97 | =back | ||||||||||||
| 98 | |||||||||||||
| 99 | |||||||||||||
| 100 | =head1 ACKNOWLEDGEMENTS | ||||||||||||
| 101 | |||||||||||||
| 102 | |||||||||||||
| 103 | =head1 LICENSE AND COPYRIGHT | ||||||||||||
| 104 | |||||||||||||
| 105 | Copyright 2020 Google LLC and contributors | ||||||||||||
| 106 | |||||||||||||
| 107 | This program is released under the following license: Apache 2.0 | ||||||||||||
| 108 | |||||||||||||
| 109 | |||||||||||||
| 110 | =cut | ||||||||||||
| 111 | |||||||||||||
| 112 | 16 | 1; # End of Google::Auth::Exceptions | |||||||||||