| 1 | package Kubernetes::REST::Error; | ||||||||||
| 2 | 2 | our $VERSION = '1.110'; | |||||||||
| 3 | # ABSTRACT: Compatibility helper for deprecated v0 error handling | ||||||||||
| 4 | 2 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use Types::Standard qw/Str/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | extends 'Throwable::Error'; | |||||||||
| 7 | |||||||||||
| 8 | 2 | has type => (is => 'ro', isa => Str, required => 1); | |||||||||
| 9 | |||||||||||
| 10 | |||||||||||
| 11 | 2 | has detail => (is => 'ro'); | |||||||||
| 12 | |||||||||||
| 13 | |||||||||||
| 14 | 10 | ▶ | sub header { | ||||||||
|
Subroutine
header: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 15 | 10 | my $self = shift; | |||||||||
| 16 | 10 | return sprintf "Exception with type: %s: %s", $self->type, $self->message; | |||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | |||||||||||
| 20 | 10 | ▶ | sub as_string { | ||||||||
|
Subroutine
as_string: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 21 | 10 | my $self = shift; | |||||||||
| 22 | 10 | ▶ | if (defined $self->detail) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 6 | return sprintf "%s\nDetail: %s", $self->header, $self->detail; | |||||||||
| 24 | } else { | ||||||||||
| 25 | 4 | return $self->header; | |||||||||
| 26 | } | ||||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | |||||||||||
| 30 | |||||||||||
| 31 | 2 | 1; | |||||||||
| 32 | |||||||||||
| 33 | __END__ | ||||||||||