Skip to content

Parseable, consistent error messages #1436

Description

@DamienCassou

Right now, hledger check error messages are hard to parse which makes writing tools around hledger hard. Here is an example of an error output when an account is undeclared:

$ hledger check --strict
hledger: 
strict mode: undeclared account "debt"
in transaction at: "/home/cassou/Documents/configuration/ledger/2021.ledger" (lines 11-13)

and here is an error output when a transaction doesn't balance:

$ hledger check --strict
hledger: "/home/cassou/Documents/configuration/ledger/2021.ledger" (lines 16-18)
could not balance this transaction:
real postings' sum should be 0 but is: -1.00€
2021-01-01 Misc
    asset:account         -11.00€
    expense:food           10.00€

As you can see, the structures of the error messages are different, requiring different error parsers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-WISHSome kind of improvement request or proposal.checkcliCommand line parsing, options, arguments and suchlike.csvThe csv file format, csv output format, or generally CSV-related.journalThe journal file format, and its features.timeclockThe timeclock file format.timedotThe timedot file format.toolshledger developer tools, scripts, processes..

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions