Improve error logging on incorrect parsing
This commit is contained in:
parent
c6a13cc83a
commit
abf82176e5
@ -132,8 +132,12 @@ class Parser:
|
|||||||
line = line_.rstrip().split(options.separator)
|
line = line_.rstrip().split(options.separator)
|
||||||
index = Parser.index(line, options)
|
index = Parser.index(line, options)
|
||||||
|
|
||||||
date = dt.datetime.strptime(line[index.date].strip(), options.date_fmt).date()
|
try:
|
||||||
|
date_str = line[index.date].strip()
|
||||||
|
date = dt.datetime.strptime(date_str, options.date_fmt).date()
|
||||||
|
|
||||||
text = line[index.text]
|
text = line[index.text]
|
||||||
|
|
||||||
value = utils.parse_decimal(line[index.value])
|
value = utils.parse_decimal(line[index.value])
|
||||||
if index.negate:
|
if index.negate:
|
||||||
value = -value
|
value = -value
|
||||||
@ -142,8 +146,12 @@ class Parser:
|
|||||||
|
|
||||||
if options.additional_parser:
|
if options.additional_parser:
|
||||||
func(transaction)
|
func(transaction)
|
||||||
|
|
||||||
return transaction
|
return transaction
|
||||||
|
|
||||||
|
except IndexError:
|
||||||
|
raise IndexError(line_)
|
||||||
|
|
||||||
|
|
||||||
class Bank1(Parser):
|
class Bank1(Parser):
|
||||||
def __init__(self, filename: Path, bank: str, options: dict[str, Any]):
|
def __init__(self, filename: Path, bank: str, options: dict[str, Any]):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user