Bugfix and tests for filename of template errors during compilation.  Fixes #923
Merge pull request #1387 from doublerebel/bugfix-locals-error

Bugfix, tests for filename of template errors during compile. Fixes #923