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 | 22607 | use Evo -Class; | |||
3 | 4 | ||||||
3 | 20 | ||||||
3 | 3 | 3 | 2477 | use overload bool => sub {1}, '""' => sub { $_[0]->to_string }, fallback => 1; | |||
3 | 3 | 700 | |||||
3 | 27 | ||||||
2 | 464 | ||||||
3 | 767 | ||||||
4 | |||||||
5 | has 'message', required => 1; | ||||||
6 | has 'code'; | ||||||
7 | has 'res'; | ||||||
8 | |||||||
9 | |||||||
10 | 5 | 50 | 5 | 0 | 544 | sub to_string($self) { | |
5 | 50 | 10 | |||||
5 | 7 | ||||||
5 | 4 | ||||||
11 | 5 | 100 | 12 | $self->code | |||
12 | 4 | 39 | ? "[${\$self->code}] ${\$self->message}" | ||||
4 | 20 | ||||||
13 | 1 | 6 | : "[connection error] ${\$self->message}"; | ||||
14 | } | ||||||
15 | |||||||
16 | |||||||
17 | 1; | ||||||
18 | |||||||
19 | __END__ |