-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.py
More file actions
executable file
·59 lines (37 loc) · 1.59 KB
/
errors.py
File metadata and controls
executable file
·59 lines (37 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -*- coding: utf-8 -*-
class fwfileError(Exception):
"""Excessao base para o CNAB 240"""
class AssignmentFieldError(fwfileError):
"""Tentativa de atribuicao de valor indevido ao campo"""
def __init__(self, field, value):
self.field = field
self.value = value
super(AssignmentFieldError, self).__init__()
def __str__(self):
return 'field:{0} format:{1} decimals:{2} digits:{3} - value:{4}'.\
format(
self.field.name,
self.field.formatting,
self.field.decimals,
self.field.digits,
repr(self.value),
)
class NumDigitsExceededError(AssignmentFieldError):
"""Tentativa de atribuicao de valor mais longo que o campo suportaia"""
class TypeError(AssignmentFieldError):
"""Tentativa de atribuicao de tipo nao suportado pelo campo"""
class NumDecimalsError(AssignmentFieldError):
"""Numero de casasa decimais em desacordo com especificacao"""
class MissingArgsError(fwfileError):
"""Faltando argumentos na chamada do metodo"""
def __init__(self, args_missing):
self.args_missing = args_missing
super(MissingArgsError, self).__init__()
def __str__(self):
return ('The following kwargs are required and were not found: {0}').format(', '.join(self.args_missing))
class EmptyFileError(fwfileError):
"""Tentativa de escrita de arquivo vazio."""
class NoneEventError(fwfileError):
"""Tentativa de escrita de lote sem eventos. """
class RequiredFieldError(fwfileError):
"""Campo obrigatorio nao preenchido."""