Improve error messages in template parsing init().

The error message wasn't telling me which file was causing the issue, so I updated the error handling.