blib/lib/Kubernetes/REST/Error.pm untested

filter: Statementstmt 0.0% 0 / 17 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 25 CC 2 SCAR 12.8
CC
2
Cov
0%
as_string
6.0
header
2.0
BEGIN
2.0
CRAP 3.6
1 package Kubernetes::REST::Error;
2 our $VERSION = '1.108';
3 # ABSTRACT: Compatibility helper for deprecated v0 error handling
4 use Moo;
5 use Types::Standard qw/Str/;
6 extends 'Throwable::Error';
7  
8 has type => (is => 'ro', isa => Str, required => 1);
9  
10  
11 has detail => (is => 'ro');
12  
13  
14 sub header {
15 my $self = shift;
16 return sprintf "Exception with type: %s: %s", $self->type, $self->message;
17 }
18  
19  
20 sub as_string {
21 my $self = shift;
22 if (defined $self->detail) {
23 return sprintf "%s\nDetail: %s", $self->header, $self->detail;
24 } else {
25 return $self->header;
26 }
27 }
28  
29  
30  
31 1;
32  
33 __END__
34  
35 =pod
36  
37 =encoding UTF-8
38  
39 =head1 NAME
40  
41 Kubernetes::REST::Error - Compatibility helper for deprecated v0 error handling
42  
43 =head1 VERSION
44  
45 version 1.108
46  
47 =head1 DESCRIPTION
48  
49 These error classes belong to the deprecated v0 API - the v1 API croaks instead of throwing structured exceptions. They stay around so code that still catches them keeps working.
50  
51 See L<Kubernetes::REST/"UPGRADING FROM 0.02"> for migration guide.
52  
53 L<Kubernetes::REST::RemoteError> used to live in this file and now has one of
54 its own. Loading it from here is not possible - it inherits from this class, so
55 this file has to finish first - which means code that throws a C<RemoteError>
56 has to C<use Kubernetes::REST::RemoteError> itself. Code that only catches one
57 is unaffected.
58  
59 =head2 type
60  
61 Error type string.
62  
63 =head2 detail
64  
65 Optional detailed error message.
66  
67 =head2 header
68  
69 Returns the error header string.
70  
71 =head2 as_string
72  
73 Returns the full error message as a string, including detail if available.
74  
75 =head1 SEE ALSO
76  
77 =over
78  
79 =item * L<Kubernetes::REST> - Main API client
80  
81 =item * L<Kubernetes::REST::RemoteError> - Subclass carrying the HTTP status
82  
83 =back
84  
85 =head1 SUPPORT
86  
87 =head2 Issues
88  
89 Please report bugs and feature requests on GitHub at
90 L<https://github.com/pplu/kubernetes-rest/issues>.
91  
92 =head2 IRC
93  
94 Join C<#kubernetes> on C<irc.perl.org> or message Getty directly.
95  
96 =head1 CONTRIBUTING
97  
98 Contributions are welcome! Please fork the repository and submit a pull request.
99  
100 =head1 AUTHORS
101  
102 =over 4
103  
104 =item *
105  
106 Torsten Raudssus <getty@cpan.org>
107  
108 =item *
109  
110 Jose Luis Martinez Torres <jlmartin@cpan.org>
111  
112 =back
113  
114 =head1 COPYRIGHT AND LICENSE
115  
116 This software is Copyright (c) 2019-2026 by Jose Luis Martinez Torres <jlmartin@cpan.org>.
117  
118 This is free software, licensed under:
119  
120 The Apache License, Version 2.0, January 2004
121  
122 =cut