Nit: I would recommend putting the text of the error message in a variable, and then reference it the 3 times.