moved error message into method for state error checks while testing