added correct error handling to template
Merge pull request #111 from fleur/master

added correct error handling to template