refactored error template to a separate file