Fix bug 1038; Improve error handling when parsing year directives

Bugfix for [1038](http://bugs.ledger-cli.org/show_bug.cgi?id=1038)