Improve error message on template semantir errors