set error to model if one occurs