Improve some error messages with malformed files
(much more useful when you are given the incriminated file name)
Merge pull request #1118 from AltGr/improve-file-errmsg

Improve some error messages with malformed files