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

Comments

Projects
None yet
2 participants
@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.

@jeevcat

This comment has been minimized.

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

This comment has been minimized.

Copy link
Owner Author

simonmichael commented Oct 14, 2017

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

@simonmichael

This comment has been minimized.

Copy link
Owner Author

simonmichael commented Oct 14, 2017

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Owner Author

simonmichael commented Oct 15, 2017

@simonmichael

This comment has been minimized.

Copy link
Owner Author

simonmichael commented Oct 15, 2017

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

@jeevcat

This comment has been minimized.

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

This comment has been minimized.

Copy link
Owner Author

simonmichael commented Oct 15, 2017

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
You can’t perform that action at this time.