reduce duplication in error templates