plenigo/Ex.pm untested

filter: Statementstmt 0.0% 0 / 12 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 17 CC 2 SCAR 15.4
CC
2
Cov
0%
e
6.0
BEGIN
2.0
CRAP 4.7
1 package plenigo::Ex;
2  
3 =head1 NAME
4  
5 plenigo::Ex - Exception thrown if something went wrong.
6  
7 =head1 SYNOPSIS
8  
9 use plenigo::Ex;
10  
11 # Throw an exception
12  
13 plenigo::Ex->throw({ code => 100, message => 'Description of the error code.' });
14  
15 =head1 DESCRIPTION
16  
17 plenigo::Ex represents an exception.
18  
19 =cut
20  
21 use Moo;
22 with 'Throwable';
23  
24 our $VERSION = '3.0002';
25  
26 has code => (is=>'ro');
27 has message => (is=>'ro');
28 has errorDetails => (is => 'ro');
29  
30 sub e {
31 if (ref($_) eq 'plenigo::Ex') {
32 return $_;
33 } else {
34 chomp; return plenigo::Ex->new(message => $_, code=>0);
35 }
36 }
37  
38 1;