added a better abstraction for error templates