Sets the error flag and error message properties.