Testing for template before throwing error