blib/lib/Mojo/Pua/Error.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 16 | 16 | 100.0 |
branch | 4 | 6 | 66.6 |
condition | n/a | ||
subroutine | 4 | 4 | 100.0 |
pod | 0 | 1 | 0.0 |
total | 24 | 27 | 88.8 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Mojo::Pua::Error; | ||||||
2 | 3 | 3 | 21618 | use Evo -Class; | |||
3 | 6 | ||||||
3 | 21 | ||||||
3 | 3 | 3 | 2258 | use overload bool => sub {1}, '""' => sub { $_[0]->to_string }, fallback => 1; | |||
3 | 2 | 759 | |||||
3 | 25 | ||||||
2 | 454 | ||||||
3 | 407 | ||||||
4 | |||||||
5 | has 'message', required => 1; | ||||||
6 | has 'code'; | ||||||
7 | has 'res'; | ||||||
8 | |||||||
9 | |||||||
10 | 5 | 50 | 5 | 0 | 418 | sub to_string($self) { | |
5 | 50 | 22 | |||||
5 | 5 | ||||||
5 | 5 | ||||||
11 | 5 | 100 | 11 | $self->code | |||
12 | 4 | 40 | ? "[${\$self->code}] ${\$self->message}" | ||||
4 | 19 | ||||||
13 | 1 | 6 | : "[connection error] ${\$self->message}"; | ||||
14 | } | ||||||
15 | |||||||
16 | |||||||
17 | 1; | ||||||
18 | |||||||
19 | __END__ |