Building the error message may be costly. In this case it's better to use an if statement instead