Throwing an exception if the template isn't set