Skip to content
Snippets Groups Projects
Commit 2875fd06 authored by Daniele Nicolodi's avatar Daniele Nicolodi
Browse files

balance: Improve ledger validation errors reporting

parent a60c6e5c
No related branches found
No related tags found
No related merge requests found
import click import click
import sys
import tomli as toml import tomli as toml
import petl import petl
import petlutils import petlutils
...@@ -10,6 +11,7 @@ from os import path ...@@ -10,6 +11,7 @@ from os import path
from orders import list_designated_accounts from orders import list_designated_accounts
from beancount import loader from beancount import loader
from beancount.parser.printer import print_errors
from beancount.core import amount, data, inventory from beancount.core import amount, data, inventory
...@@ -42,7 +44,9 @@ def main(): ...@@ -42,7 +44,9 @@ def main():
ledger = path.normpath(path.expanduser(conf['ledger'])) ledger = path.normpath(path.expanduser(conf['ledger']))
entries, errors, options = loader.load_file(ledger) entries, errors, options = loader.load_file(ledger)
assert not errors if errors:
print_errors(errors)
sys.exit(1)
accounts = set(list_designated_accounts(entries)) accounts = set(list_designated_accounts(entries))
balances = cumulative_balances_by_year(entries, accounts, unpack=True) balances = cumulative_balances_by_year(entries, accounts, unpack=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment