Parse errors correctly

**Ready to MERGE**

Fixes #1072
- ~~Needs tests~~