Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

balance assertion errors should show a more accurate line number #481

Closed
simonmichael opened this issue Jan 15, 2017 · 8 comments
Closed
Labels
A-WISH Some kind of improvement request, hare-brained proposal, or plea. good-first-issue If you're a new contributor, this might be a good one for you. journal The journal file format, and its features.

Comments

@simonmichael
Copy link
Owner

simonmichael commented Jan 15, 2017

Currently they show the line number where the transaction starts. Better to show the line number of the posting with the failing assertion.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@simonmichael simonmichael added A-WISH Some kind of improvement request, hare-brained proposal, or plea. easy? journal The journal file format, and its features. labels Jan 15, 2017
@jeevcat
Copy link
Collaborator

jeevcat commented Oct 14, 2017

I was thinking about having a look at this issue as something easy to get me started contributing. However, as far as I can tell, there are currently no line numbers being printed for balance assertion errors?
I'm looking here and at the following strings at 417 and 419.

@simonmichael simonmichael added the good-first-issue If you're a new contributor, this might be a good one for you. label Oct 14, 2017
@simonmichael
Copy link
Owner Author

Great. That's actually a different error (unbalanced transaction). Here's the balance assertion error.

@simonmichael
Copy link
Owner Author

I notice it says column 0 which looks a little odd, I wonder how hard it would be to show just the line number, or (gold plated version) the actual column of the = sign.

@jeevcat
Copy link
Collaborator

jeevcat commented Oct 15, 2017

I have this working now, but it only finds the column using the output of postingAsLines or show transaction. However, this isn't always the same as what is written in a journal file.

I can see that I can get the transaction's 1-based position in the input stream from a Transaction. How can I access the current input stream from the checkBalanceAssertion function?

@simonmichael
Copy link
Owner Author

simonmichael commented Oct 15, 2017 via email

@simonmichael
Copy link
Owner Author

PS if you think it's worth the trouble. Or we could just not show a column number.

@jeevcat
Copy link
Collaborator

jeevcat commented Oct 15, 2017

Can we go with type BalanceAssertion = (Maybe Amount, Maybe GenericSourcePos) instead?

In some places I'm unable to populate the source position easily - like in Equity.hs and CSV parsing.

@simonmichael
Copy link
Owner Author

I was wondering how tsourcepos handles that.. it uses nullsourcepos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-WISH Some kind of improvement request, hare-brained proposal, or plea. good-first-issue If you're a new contributor, this might be a good one for you. journal The journal file format, and its features.
Projects
None yet
Development

No branches or pull requests

2 participants