Allow themes to provide custom error template.

fixes #1212, #1213