1
2
3
4
5
6
7
8
9
10
11
12
13 """
14 """
15
16 import errors
17
18 isa_errors = ('000' ,'001' ,'002' ,'003' ,'004' ,'005' ,'006' ,'007' ,'008' ,
19 '009' ,'010' ,'011' ,'012' ,'013' ,'014' ,'015' ,'016' ,
20 '017' ,'018' ,'019' ,'020' ,'021' ,'022' ,'023' ,'024' ,
21 '025' ,'026' ,'027' ,'028' ,'029' ,'030' ,'031')
22 seg_errors = ('1', '2', '3', '4', '5', '6', '7', '8')
23 ele_errors = ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10')
24
26 """
27 Wrap an X12 validation error
28 """
29 - def __init__(self, err_type, err_cde, err_str):
30 """
31 @param err_type: At what level did the error occur
32 @type err_type: string
33 @param err_cde: Segment level error code
34 @type err_cde: string
35 @param err_str: Description of the error
36 @type err_str: string
37 """
38 self.err_cde = err_cde
39 self.err_str = err_str
40
43
46
47
54
55
57 - def __init__(self, err_cde, err_str, err_val=None):
63
66
67
69 - def __init__(self, err_cde, err_str, ele_idx, subele_idx=None,
70 err_val=None):
71 ErrorItem.__init__(self, 'ele', err_cde, err_str)
72 self.err_val = err_val
73 self.ele_idx = ele_idx
74 self.subele_idx = subele_idx
75 if self.err_cde not in ele_errors:
76 raise errors.EngineError, 'Invalid element level error code "%s"' % \
77 (self.err_cde)
78
81
84
86 return self.subele_idx
87