| 1 | #!/usr/bin/false | ||||||||||
| 2 | # ABSTRACT: Exception class for WebService::Bugzilla HTTP errors | ||||||||||
| 3 | # PODNAME: WebService::Bugzilla::Exception | ||||||||||
| 4 | |||||||||||
| 5 | package WebService::Bugzilla::Exception 0.001; | ||||||||||
| 6 | 1 | ▶ | use strictures 2; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use overload '""' => \&as_string, fallback => 1; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | has bz_code => (is => 'ro'); | |||||||||
| 12 | 1 | has http_status => (is => 'ro'); | |||||||||
| 13 | 1 | has message => (is => 'ro', required => 1); | |||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | sub as_string { | ||||||||
|
Subroutine
as_string: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 16 | 0 | my ($self) = @_; | |||||||||
| 17 | 0 | my $str = $self->message; | |||||||||
| 18 | 0 | ▶ | $str .= ' [bz:' . $self->bz_code . ']' | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | if defined $self->bz_code; | ||||||||||
| 20 | 0 | ▶ | $str .= ' [http:' . $self->http_status . ']' | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | if defined $self->http_status; | ||||||||||
| 22 | 0 | return $str; | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 0 | ▶ | sub throw { | ||||||||
|
Subroutine
throw: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 26 | 0 | my ($class, %args) = @_; | |||||||||
| 27 | 0 | die $class->new(%args); | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 1 | 1; | |||||||||
| 31 | |||||||||||
| 32 | __END__ | ||||||||||