Improve error handling

Print errors explicitly instead of automatically while parsing.