Added template context on rendering error

When a template rendering error occurs, show the part of the template
where the problem happened in order to make it easier to track down.
Added tests for error template context.
Merge pull request #7338 from rca/template_error_context

Template error context