Docker/ContainerException.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 26 CC 2 SCAR 12.8
CC
2
Cov
0%
ERROR_CODE
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.6
1 package Eixo::Docker::ContainerException;
2  
3 use strict;
4 use warnings;
5  
6 use Eixo::Base::Clase qw(Eixo::Rest::BaseException);
7  
8  
9 my $ERRORS = {
10 404 => "No such container",
11 400 => "Bad parameter",
12 406 => "Impossible to attach (container not running)",
13 500 => "Server error",
14 };
15  
16 sub ERROR_CODE {
17
18 my $self = $_[0];
19  
20 my $error_code = $self->args->[0];
21  
22 if (exists($ERRORS->{$error_code})){
23 $self->error($ERRORS->{$error_code});
24 $self->error_details('Error produced in \''.$self->method.'\' api call. Details: '.join(' - ', @{$self->args}));
25 }
26 else{
27  
28 $self->error("Unknown error code");
29 $self->error_details("Unknown error code $error_code produced in $self->method")
30 }
31  
32
33 }
34