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
Comments
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? |
Great. That's actually a different error (unbalanced transaction). Here's the balance assertion error. |
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. |
I have this working now, but it only finds the column using the output of 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 |
To do it robustly I guess we'd have to save the position of the balance assertion during parsing, similar to Transaction.tsourcepos. Perhaps:
type BalanceAssertion = Maybe (Amount, GenericSourcePos)
data Posting = Posting {... pbalanceassertion :: BalanceAssertion ...}
|
PS if you think it's worth the trouble. Or we could just not show a column number. |
Can we go with In some places I'm unable to populate the source position easily - like in Equity.hs and CSV parsing. |
I was wondering how tsourcepos handles that.. it uses nullsourcepos. |
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.
The text was updated successfully, but these errors were encountered: