| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Lib::Pepper::Exception; |
|
2
|
|
|
|
|
|
|
#---AUTOPRAGMASTART--- |
|
3
|
5
|
|
|
5
|
|
77
|
use v5.42; |
|
|
5
|
|
|
|
|
31
|
|
|
4
|
5
|
|
|
5
|
|
33
|
use strict; |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
200
|
|
|
5
|
5
|
|
|
5
|
|
28
|
use diagnostics; |
|
|
5
|
|
|
|
|
10
|
|
|
|
5
|
|
|
|
|
33
|
|
|
6
|
5
|
|
|
5
|
|
252
|
use mro 'c3'; |
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
30
|
|
|
7
|
5
|
|
|
5
|
|
237
|
use English; |
|
|
5
|
|
|
|
|
10
|
|
|
|
5
|
|
|
|
|
63
|
|
|
8
|
5
|
|
|
5
|
|
2243
|
use Carp qw[carp croak confess cluck longmess shortmess]; |
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
629
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = 0.5; |
|
10
|
5
|
|
|
5
|
|
42
|
use autodie qw( close ); |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
38
|
|
|
11
|
5
|
|
|
5
|
|
1732
|
use Array::Contains; |
|
|
5
|
|
|
|
|
41
|
|
|
|
5
|
|
|
|
|
431
|
|
|
12
|
5
|
|
|
5
|
|
39
|
use utf8; |
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
35
|
|
|
13
|
5
|
|
|
5
|
|
156
|
use Data::Dumper; |
|
|
5
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
313
|
|
|
14
|
5
|
|
|
5
|
|
33
|
use Data::Printer; |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
35
|
|
|
15
|
|
|
|
|
|
|
#---AUTOPRAGMAEND--- |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
5
|
|
|
5
|
|
4105
|
use Lib::Pepper::Constants qw(:errors); |
|
|
5
|
|
|
|
|
26
|
|
|
|
5
|
|
|
|
|
6651
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# Error code to message mapping |
|
21
|
|
|
|
|
|
|
my %ERROR_MESSAGES = ( |
|
22
|
|
|
|
|
|
|
# Success |
|
23
|
|
|
|
|
|
|
0 => 'Success', |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Generic failures |
|
26
|
|
|
|
|
|
|
-1 => 'Generic failure', |
|
27
|
|
|
|
|
|
|
-2 => 'Invalid value provided', |
|
28
|
|
|
|
|
|
|
-3 => 'Invalid state', |
|
29
|
|
|
|
|
|
|
-4 => 'Functionality not licensed', |
|
30
|
|
|
|
|
|
|
-5 => 'Out of memory', |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Library initialization errors |
|
33
|
|
|
|
|
|
|
-100 => 'Library initialization failed', |
|
34
|
|
|
|
|
|
|
-101 => 'Library already initialized', |
|
35
|
|
|
|
|
|
|
-102 => 'Library loading error', |
|
36
|
|
|
|
|
|
|
-103 => 'Library not initialized', |
|
37
|
|
|
|
|
|
|
-104 => 'Library version mismatch', |
|
38
|
|
|
|
|
|
|
-105 => 'Library dependency error', |
|
39
|
|
|
|
|
|
|
-106 => 'Library still in use', |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Configuration errors |
|
42
|
|
|
|
|
|
|
-200 => 'Configuration error', |
|
43
|
|
|
|
|
|
|
-201 => 'Invalid configuration', |
|
44
|
|
|
|
|
|
|
-202 => 'Missing configuration file', |
|
45
|
|
|
|
|
|
|
-203 => 'Configuration file invalid', |
|
46
|
|
|
|
|
|
|
-204 => 'Configuration incomplete', |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# Logging errors |
|
49
|
|
|
|
|
|
|
-300 => 'Logging error', |
|
50
|
|
|
|
|
|
|
-301 => 'Logging initialization failed', |
|
51
|
|
|
|
|
|
|
-302 => 'Logging file creation failed', |
|
52
|
|
|
|
|
|
|
-303 => 'Logging file write failed', |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# Persistence errors |
|
55
|
|
|
|
|
|
|
-400 => 'Persistence error', |
|
56
|
|
|
|
|
|
|
-401 => 'Database error', |
|
57
|
|
|
|
|
|
|
-402 => 'File error', |
|
58
|
|
|
|
|
|
|
-403 => 'Data corrupt', |
|
59
|
|
|
|
|
|
|
-404 => 'No data found', |
|
60
|
|
|
|
|
|
|
-405 => 'Invalid data', |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# Core errors |
|
63
|
|
|
|
|
|
|
-500 => 'Core error', |
|
64
|
|
|
|
|
|
|
-501 => 'Core initialization failed', |
|
65
|
|
|
|
|
|
|
-502 => 'Core operation failed', |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# License errors |
|
68
|
|
|
|
|
|
|
-700 => 'License error', |
|
69
|
|
|
|
|
|
|
-701 => 'Invalid license', |
|
70
|
|
|
|
|
|
|
-702 => 'License expired', |
|
71
|
|
|
|
|
|
|
-703 => 'License not found', |
|
72
|
|
|
|
|
|
|
-704 => 'License download failed', |
|
73
|
|
|
|
|
|
|
-705 => 'License verification failed', |
|
74
|
|
|
|
|
|
|
-706 => 'Feature not licensed', |
|
75
|
|
|
|
|
|
|
-707 => 'Terminal not licensed', |
|
76
|
|
|
|
|
|
|
-708 => 'License limit exceeded', |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# Handle errors |
|
79
|
|
|
|
|
|
|
-1_000 => 'Invalid handle', |
|
80
|
|
|
|
|
|
|
-1_001 => 'Null handle', |
|
81
|
|
|
|
|
|
|
-1_002 => 'Handle not found', |
|
82
|
|
|
|
|
|
|
-1_003 => 'Handle type mismatch', |
|
83
|
|
|
|
|
|
|
-1_004 => 'Handle creation failed', |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# Option list errors |
|
86
|
|
|
|
|
|
|
-1_100 => 'Option list error', |
|
87
|
|
|
|
|
|
|
-1_101 => 'Option element not found', |
|
88
|
|
|
|
|
|
|
-1_102 => 'Option type mismatch', |
|
89
|
|
|
|
|
|
|
-1_103 => 'Invalid option key', |
|
90
|
|
|
|
|
|
|
-1_104 => 'Option list empty', |
|
91
|
|
|
|
|
|
|
-1_105 => 'Duplicate option key', |
|
92
|
|
|
|
|
|
|
-1_106 => 'Option list operation failed', |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# Instance errors |
|
95
|
|
|
|
|
|
|
-1_200 => 'Instance error', |
|
96
|
|
|
|
|
|
|
-1_201 => 'Instance creation failed', |
|
97
|
|
|
|
|
|
|
-1_202 => 'Instance not configured', |
|
98
|
|
|
|
|
|
|
-1_203 => 'Instance invalid state', |
|
99
|
|
|
|
|
|
|
-1_204 => 'Operation pending', |
|
100
|
|
|
|
|
|
|
-1_205 => 'Instance not open', |
|
101
|
|
|
|
|
|
|
-1_206 => 'Instance already open', |
|
102
|
|
|
|
|
|
|
-1_207 => 'Instance configuration error', |
|
103
|
|
|
|
|
|
|
-1_208 => 'Instance callback error', |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# State machine errors |
|
106
|
|
|
|
|
|
|
-1_300 => 'State machine error', |
|
107
|
|
|
|
|
|
|
-1_301 => 'Invalid state transition', |
|
108
|
|
|
|
|
|
|
-1_302 => 'Operation not allowed', |
|
109
|
|
|
|
|
|
|
-1_303 => 'State machine timeout', |
|
110
|
|
|
|
|
|
|
-1_304 => 'Operation aborted', |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# Card type errors |
|
113
|
|
|
|
|
|
|
-1_400 => 'Card type error', |
|
114
|
|
|
|
|
|
|
-1_401 => 'Card type not found', |
|
115
|
|
|
|
|
|
|
-1_402 => 'Card type configuration error', |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# Communication errors |
|
118
|
|
|
|
|
|
|
-1_500 => 'Communication error', |
|
119
|
|
|
|
|
|
|
-1_501 => 'Connection failed', |
|
120
|
|
|
|
|
|
|
-1_502 => 'Disconnected', |
|
121
|
|
|
|
|
|
|
-1_503 => 'Communication timeout', |
|
122
|
|
|
|
|
|
|
-1_504 => 'Send error', |
|
123
|
|
|
|
|
|
|
-1_505 => 'Receive error', |
|
124
|
|
|
|
|
|
|
-1_506 => 'Protocol error', |
|
125
|
|
|
|
|
|
|
-1_507 => 'Invalid response', |
|
126
|
|
|
|
|
|
|
-1_508 => 'Terminal busy', |
|
127
|
|
|
|
|
|
|
-1_509 => 'Terminal error', |
|
128
|
|
|
|
|
|
|
); |
|
129
|
|
|
|
|
|
|
|
|
130
|
0
|
|
|
0
|
1
|
|
sub checkResult($self, $result, $context) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
131
|
0
|
0
|
|
|
|
|
if(!defined $result) { |
|
132
|
0
|
|
|
|
|
|
croak("Undefined result code in context: $context"); |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
0
|
0
|
|
|
|
|
if($result >= PEP_FUNCTION_RESULT_SUCCESS) { |
|
136
|
0
|
|
|
|
|
|
return 1; |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
0
|
|
0
|
|
|
|
my $message = $ERROR_MESSAGES{$result} || "Unknown error code: $result"; |
|
140
|
0
|
0
|
|
|
|
|
my $fullMessage = $context ? "$context: $message (code: $result)" : "$message (code: $result)"; |
|
141
|
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
croak($fullMessage); |
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
|
|
145
|
0
|
|
|
0
|
1
|
|
sub getErrorMessage($self, $result) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
146
|
0
|
|
0
|
|
|
|
return $ERROR_MESSAGES{$result} || "Unknown error code: $result"; |
|
147
|
|
|
|
|
|
|
} |
|
148
|
|
|
|
|
|
|
|
|
149
|
0
|
|
|
0
|
1
|
|
sub isSuccess($self, $result) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
150
|
0
|
|
0
|
|
|
|
return defined($result) && $result >= PEP_FUNCTION_RESULT_SUCCESS; |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
|
|
153
|
0
|
|
|
0
|
1
|
|
sub isFailure($self, $result) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
154
|
0
|
|
0
|
|
|
|
return !defined($result) || $result < PEP_FUNCTION_RESULT_SUCCESS; |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
1; |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
__END__ |