improve error reporting

Note original file and line number of invalid code blocks.