BIMI/Error.pm

filter: Statementstmt 100% 18 / 18 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 100% 28 / 28 CC 2 SCAR 2.5
CC
2
Cov
100%
result
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« BIMI/Base.pm ↑ Summary BIMI/Role/Data.pm »
1 package Mail::BIMI::Error;
2 # ABSTRACT: Class to represent an error condition
3 29 our $VERSION = '3.20261116'; # VERSION
4 29 ▶use 5.20.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 29 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 29 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 29 ▶use Mail::BIMI::Prelude;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 29 my %ERROR_MAP = (
10 BIMI_INVALID => { description => 'Invalid BIMI Record' },
11 BIMI_NOT_ENABLED => { description => 'Domain is not BIMI enabled' },
12 CODE_MISSING_AUTHORITY => { description => 'No authority specified', result => 'temperror' },
13 CODE_MISSING_LOCATION => { description => 'No location specified', result => 'temperror' },
14 CODE_NOTHING_TO_VALIDATE => { description => 'Nothing To Validate', result => 'temperror' },
15 CODE_NO_DATA => { description => 'No Data', result => 'temperror' },
16 DMARC_NOT_ENFORCING => { description => 'DMARC Policy is not at enforcement', result => 'skipped' },
17 DMARC_NOT_PASS => { description => 'DMARC did not pass', result => 'skipped' },
18 DNS_ERROR => { description => 'DNS query error', result => 'temperror' },
19 DUPLICATE_KEY => { description => 'Duplicate key in record' },
20 EMPTY_L_TAG => { description => 'Domain declined to participate', result => 'declined' },
21 EMPTY_V_TAG => { description => 'Empty v tag' },
22 INVALID_RECORD => { description => 'BIMI record is invalid' },
23 INVALID_TRANSPORT_A => { description => 'Invalid transport in authority' },
24 INVALID_TRANSPORT_L => { description => 'Invalid transport in location' },
25 INVALID_V_TAG => { description => 'Invalid v tag' },
26 MISSING_L_TAG => { description => 'Missing l tag' },
27 MISSING_V_TAG => { description => 'Missing v tag' },
28 MULTIPLE_AUTHORITIES => { description => 'Multiple entries for a found' },
29 MULTIPLE_LOCATIONS => { description => 'Multiple entries for l found' },
30 MULTI_BIMI_RECORD => { description => 'Multiple BIMI records found' },
31 NO_BIMI_RECORD => { description => 'No BIMI records found', result => 'none' },
32 NO_DKIM => { description => 'Insufficient authentication, DKIM required', result => 'skipped' },
33 NO_DMARC => { description => 'No DMARC', result => 'skipped' },
34 SPF_PLUS_ALL => { description => 'SPF +all detected', result => 'skipped' },
35 SVG_FETCH_ERROR => { description => 'Could not fetch SVG', result => 'temperror' },
36 SVG_GET_ERROR => { description => 'Could not fetch SVG', result => 'temperror' },
37 SVG_INVALID_XML => { description => 'Invalid XML in SVG' },
38 SVG_MISMATCH => { description => 'SVG in bimi-location did not match SVG in VMC' },
39 SVG_SIZE => { description => 'SVG Document exceeds maximum size' },
40 SVG_UNZIP_ERROR => { description => 'Error unzipping SVG' },
41 SVG_VALIDATION_ERROR => { description => 'SVG did not validate' },
42 VMC_EXPIRED => { description => 'VMC has expired' },
43 VMC_FETCH_ERROR => { description => 'Could not fetch VMC', result => 'temperror' },
44 VMC_PARSE_ERROR => { description => 'Could not parse VMC' },
45 VMC_REQUIRED => { description => 'VMC is required' },
46 VMC_VALIDATION_ERROR => { description => 'VMC did not validate' },
47 VMC_NO_EXPERIMENTAL => { description => 'Experimental VMC not accepted here' },
48 VMC_DISALLOWED_TYPE => { description => 'VMC Mark Type not supported here' },
49 );
50  
51 29 has code => ( is => 'ro', isa => enum([sort keys %ERROR_MAP]), required => 1,
52 documentation => 'inputs: Error code', );
53 29 has detail => ( is => 'ro', isa => 'Str', required => 0,
54 documentation => 'inputs: Human readable details', );
55  
56  
57 43 ▶sub description($self) {
Subroutine description: called CC=1 SCAR=0.0
Pod documented
58 43 return $ERROR_MAP{$self->code}->{description};
59 }
60  
61  
62 10 ▶sub result($self) {
Subroutine result: called CC=2 SCAR=6.9
Pod documented
63 10 ▶ return exists $ERROR_MAP{$self->code}->{result} ? $ERROR_MAP{$self->code}->{result} : 'fail';
Branch: 1 branch
BranchTrueFalseTotal
exists $ERROR_MAP{$self->code}{'result'} ? : 7 3 10
64 }
65  
66  
67 29 1;
68  
69 __END__
« BIMI/Base.pm ↑ Summary BIMI/Role/Data.pm »