| 1 | package API::Docker::Error::Timeout; | ||
| 2 | # ABSTRACT: Read timeout while waiting for the Docker Engine | ||
| 3 | 52 | our $VERSION = '0.006'; | |
| 4 | 52 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | # namespace::clean has to come BEFORE "use overload" here, not after it as | ||
| 6 | # everywhere else in this distribution -- same reason as in | ||
| 7 | # API::Docker::Error::Stream and API::Docker::Error::HTTP. It sweeps the | ||
| 8 | # symbols `overload` installs -- the `("" ` slot among them -- so with the two | ||
| 9 | # lines in the house order the class ends up not overloaded at all and | ||
| 10 | # stringifies as API::Docker::Error::Timeout=HASH(0x...). Nothing dies when | ||
| 11 | # that happens: every caller that only inspects $@ as a string silently starts | ||
| 12 | # seeing a reference address instead of the reason. Measured, not assumed: | ||
| 13 | # overload::Overloaded($err) is false with the lines swapped. | ||
| 14 | 52 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | use overload | ||
| 16 | 5 | ▶ | '""' => sub { $_[0]->as_string }, |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 17 | 101 | ▶ | 'bool' => sub { 1 }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 18 | 52 | fallback => 1; | |
| 19 | |||
| 20 | |||
| 21 | 52 | has message => ( | |
| 22 | is => 'ro', | ||
| 23 | required => 1, | ||
| 24 | ); | ||
| 25 | |||
| 26 | |||
| 27 | has location => ( | ||
| 28 | is => 'ro', | ||
| 29 | 1 | ▶ | default => sub { '' }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 30 | 52 | ); | |
| 31 | |||
| 32 | |||
| 33 | has endpoint => ( | ||
| 34 | is => 'ro', | ||
| 35 | 1 | ▶ | default => sub { '' }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 36 | 52 | ); | |
| 37 | |||
| 38 | |||
| 39 | has phase => ( | ||
| 40 | is => 'ro', | ||
| 41 | 28 | ▶ | default => sub { 'read' }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 42 | 52 | ); | |
| 43 | |||
| 44 | |||
| 45 | 52 | has timeout => ( | |
| 46 | is => 'ro', | ||
| 47 | required => 1, | ||
| 48 | ); | ||
| 49 | |||
| 50 | |||
| 51 | has partial => ( | ||
| 52 | is => 'ro', | ||
| 53 | 2 | ▶ | default => sub { '' }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 54 | 52 | ); | |
| 55 | |||
| 56 | |||
| 57 | 52 | has summary => ( | |
| 58 | is => 'ro', | ||
| 59 | ); | ||
| 60 | |||
| 61 | |||
| 62 | 5 | ▶ | sub as_string { $_[0]->message . $_[0]->location } |
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
documented
| |||
| 63 | |||
| 64 | |||
| 65 | |||
| 66 | 52 | 1; | |
| 67 | |||
| 68 | __END__ | ||